Commit d454b578 authored by Jack Jansen's avatar Jack Jansen

Has been dead so long that there's no use keeping it in the active bit of the repository.

parent 95bf9390
/*********************************************************************
Project : GUSI - Grand Unified Socket Interface
File : GUSI.h - Socket calls
Author : Matthias Neeracher
Language : MPW C/C++
$Log$
Revision 1.1 2000/09/12 20:24:50 jack
Moved to Unsupported.
Revision 1.1 1998/08/18 14:52:33 jack
Putting Python-specific GUSI modifications under CVS.
Revision 1.2 1994/12/31 01:45:54 neeri
Fix alignment.
Revision 1.1 1994/02/25 02:56:49 neeri
Initial revision
Revision 0.15 1993/06/27 00:00:00 neeri
f?truncate
Revision 0.14 1993/06/20 00:00:00 neeri
Changed sa_constr_ppc
Revision 0.13 1993/02/14 00:00:00 neeri
AF_PAP
Revision 0.12 1992/12/08 00:00:00 neeri
getcwd()
Revision 0.11 1992/11/15 00:00:00 neeri
remove netdb.h definitions
Revision 0.10 1992/09/26 00:00:00 neeri
Separate dirent and stat
Revision 0.9 1992/09/12 00:00:00 neeri
Hostname stuff
Revision 0.8 1992/09/07 00:00:00 neeri
readlink()
Revision 0.7 1992/08/03 00:00:00 neeri
sa_constr_ppc
Revision 0.6 1992/07/21 00:00:00 neeri
sockaddr_atlk_sym
Revision 0.5 1992/06/26 00:00:00 neeri
choose()
Revision 0.4 1992/05/18 00:00:00 neeri
PPC stuff
Revision 0.3 1992/04/27 00:00:00 neeri
getsockopt()
Revision 0.2 1992/04/19 00:00:00 neeri
C++ compatibility
Revision 0.1 1992/04/17 00:00:00 neeri
bzero()
*********************************************************************/
#ifndef _GUSI_
#define _GUSI_
#include <sys/types.h>
/* Feel free to increase FD_SETSIZE as needed */
#define GUSI_MAX_FD FD_SETSIZE
#include <sys/cdefs.h>
#include <compat.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
#include <dirent.h>
#include <Types.h>
#include <Events.h>
#include <Files.h>
#include <AppleTalk.h>
#include <CTBUtilities.h>
#include <Packages.h>
#include <PPCToolBox.h>
#include <StandardFile.h>
#include <stdio.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <string.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/un.h>
#include <unistd.h>
#include <machine/endian.h>
typedef enum spin_msg {
SP_MISC, /* some weird thing, usually just return immediately if you get this */
SP_SELECT, /* in a select call */
SP_NAME, /* getting a host by name */
SP_ADDR, /* getting a host by address */
SP_STREAM_READ, /* Stream read call */
SP_STREAM_WRITE, /* Stream write call */
SP_DGRAM_READ, /* Datagram read call */
SP_DGRAM_WRITE, /* Datagram write call */
SP_SLEEP, /* sleeping, passes ticks left to sleep */
SP_AUTO_SPIN /* Autospin, passes argument to SpinCursor */
} spin_msg;
typedef int (*GUSISpinFn)(spin_msg msg, long param);
typedef void (*GUSIEvtHandler)(EventRecord * ev);
typedef GUSIEvtHandler GUSIEvtTable[24];
/*
* Address families, defined in sys/socket.h
*
#define AF_UNSPEC 0 // unspecified
#define AF_UNIX 1 // local to host (pipes, portals)
#define AF_INET 2 // internetwork: UDP, TCP, etc.
#define AF_CTB 3 // Apple Comm Toolbox (not yet supported)
#define AF_FILE 4 // Normal File I/O (used internally)
#define AF_PPC 5 // PPC Toolbox
#define AF_PAP 6 // Printer Access Protocol (client only)
#define AF_APPLETALK 16 // Apple Talk
*/
#define ATALK_SYMADDR 272 /* Symbolic Address for AppleTalk */
/*
* Some Implementations of GUSI require you to call GUSISetup for the
* socket families you'd like to have defined. It's a good idea to call
* this for *all* implementations.
*
* GUSIDefaultSetup() will include all socket families.
*
* Never call any of the GUSIwithXXX routines directly.
*/
__BEGIN_DECLS
void GUSIwithAppleTalkSockets();
void GUSIwithInternetSockets();
void GUSIwithPAPSockets();
void GUSIwithPPCSockets();
void GUSIwithUnixSockets();
void GUSIwithSIOUXSockets();
void GUSIwithMPWSockets();
void GUSISetup(void (*socketfamily)());
void GUSIDefaultSetup();
void GUSILoadConfiguration(Handle);
__END_DECLS
/*
* Types, defined in sys/socket.h
*
#define SOCK_STREAM 1 // stream socket
#define SOCK_DGRAM 2 // datagram socket
*/
/*
* Defined in sys/un.h
*
struct sockaddr_un {
short sun_family;
char sun_path[108];
};
*/
#ifndef PRAGMA_ALIGN_SUPPORTED
#error Apple had some fun with the conditional macros again
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
struct sockaddr_atlk {
short family;
AddrBlock addr;
};
struct sockaddr_atlk_sym {
short family;
EntityName name;
};
struct sockaddr_ppc {
short family;
LocationNameRec location;
PPCPortRec port;
};
/* Definitions for choose() */
#define CHOOSE_DEFAULT 1 /* Use *name as default name */
#define CHOOSE_NEW 2 /* Choose new entity name, not existing one */
#define CHOOSE_DIR 4 /* Choose a directory name, not a file */
typedef struct {
short numTypes;
SFTypeList types;
} sa_constr_file;
typedef struct {
short numTypes;
NLType types;
} sa_constr_atlk;
/* Definitions for sa_constr_ppc */
#define PPC_CON_NEWSTYLE 0x8000 /* Required */
#define PPC_CON_MATCH_NAME 0x0001 /* Match name */
#define PPC_CON_MATCH_TYPE 0x0002 /* Match port type */
#define PPC_CON_MATCH_NBP 0x0004 /* Match NBP type */
typedef struct {
short flags;
Str32 nbpType;
PPCPortRec match;
} sa_constr_ppc;
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
__BEGIN_DECLS
/*
* IO/Socket stuff, defined elsewhere (unistd.h, sys/socket.h
*
int socket(int domain, int type, short protocol);
int bind(int s, void *name, int namelen);
int connect(int s, void *addr, int addrlen);
int listen(int s, int qlen);
int accept(int s, void *addr, int *addrlen);
int close(int s);
int read(int s, char *buffer, unsigned buflen);
int readv(int s, struct iovec *iov, int count);
int recv(int s, void *buffer, int buflen, int flags);
int recvfrom(int s, void *buffer, int buflen, int flags, void *from, int *fromlen);
int recvmsg(int s,struct msghdr *msg,int flags);
int write(int s, const char *buffer, unsigned buflen);
int writev(int s, struct iovec *iov, int count);
int send(int s, void *buffer, int buflen, int flags);
int sendto (int s, void *buffer, int buflen, int flags, void *to, int tolen);
int sendmsg(int s,struct msghdr *msg,int flags);
int select(int width, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
int getdtablesize(void);
int getsockname(int s, void *name, int *namelen);
int getpeername(int s, struct sockaddr *name, int *namelen);
int shutdown(int s, int how);
int fcntl(int s, unsigned int cmd, int arg);
int dup(int s);
int dup2(int s, int s1);
int ioctl(int d, unsigned int request, long *argp);
int getsockopt(int s, int level, int optname, char *optval, int * optlen);
int setsockopt(int s, int level, int optname, char *optval, int optlen);
int isatty(int);
int remove(const char *filename);
int rename(const char *oldname, const char *newname);
int creat(const char*);
int faccess(char*, unsigned int, long*);
long lseek(int, long, int);
int open(const char*, int);
int unlink(char*);
int symlink(char* linkto, char* linkname);
int readlink(char* path, char* buf, int bufsiz);
int truncate(char *path, long length);
int ftruncate(int fd, long length);
int chdir(char * path);
int mkdir(char * path);
int rmdir(char * path);
char * getcwd(char * buf, int size);
*/
/*
* Defined in stdio.h
*/
#ifdef __MWERKS__
void fsetfileinfo (char *filename, unsigned long newcreator, unsigned long newtype);
#endif
void fgetfileinfo (char *filename, unsigned long * creator, unsigned long * type);
#ifdef __MWERKS__
FILE *fdopen(int fd, const char *mode);
int fwalk(int (*func)(FILE * stream));
#endif
int choose(
int domain,
int type,
char * prompt,
void * constraint,
int flags,
void * name,
int * namelen);
/*
* Hostname routines, defined in netdb.h
*
struct hostent * gethostbyname(char *name);
struct hostent * gethostbyaddr(struct in_addr *addrP, int, int);
int gethostname(char *machname, long buflen);
struct servent * getservbyname (char * name, char * proto);
struct protoent * getprotobyname(char * name);
*/
char * inet_ntoa(struct in_addr inaddr);
struct in_addr inet_addr(char *address);
/*
* GUSI supports a number of hooks. Every one of them has a different prototype, but needs
* to be passed as a GUSIHook
*/
typedef enum {
GUSI_SpinHook, /* A GUSISpinFn, to be called when a call blocks */
GUSI_ExecHook, /* Boolean (*hook)(const GUSIFileRef & ref), decides if file is executable */
GUSI_FTypeHook,/* Boolean (*hook)(const FSSpec & spec) sets a default file type */
GUSI_SpeedHook /* A long integer, to be added to the cursor spin variable */
} GUSIHookCode;
typedef void (*GUSIHook)(void);
void GUSISetHook(GUSIHookCode code, GUSIHook hook);
GUSIHook GUSIGetHook(GUSIHookCode code);
/*
* What to do when a routine blocks
*/
/* Defined for compatibility */
#define GUSISetSpin(routine) GUSISetHook(GUSI_SpinHook, (GUSIHook)routine)
#define GUSIGetSpin() (GUSISpinFn) GUSIGetHook(GUSI_SpinHook)
int GUSISetEvents(GUSIEvtTable table);
GUSIEvtHandler * GUSIGetEvents(void);
extern GUSIEvtHandler GUSISIOWEvents[];
#define SIGPIPE 13
#define SIGALRM 14
/*
* BSD memory routines, defined in compat.h
*
#define index(a, b) strchr(a, b)
#define rindex(a, b) strrchr(a, b)
#define bzero(from, len) memset(from, 0, len)
#define bcopy(from, to, len) memcpy(to, from, len)
#define bcmp(s1, s2, len) memcmp(s1, s2, len)
#define bfill(from, len, x) memset(from, x, len)
*/
__END_DECLS
#endif /* !_GUSI_ */
/*********************************************************************
Project : GUSI - Grand Unified Socket Interface
File : GUSI.r - Include this
Author : Matthias Neeracher
Language : MPW Rez 3.0
$Log$
Revision 1.1 2000/09/12 20:24:45 jack
Moved to Unsupported.
Revision 1.1 1998/08/18 14:52:37 jack
Putting Python-specific GUSI modifications under CVS.
Revision 1.3 1994/12/30 19:33:34 neeri
Enlargened message box for select folder dialog.
Revision 1.2 1994/08/10 00:34:18 neeri
Sanitized for universal headers.
Revision 1.1 1994/02/25 02:12:04 neeri
Initial revision
Revision 0.5 1993/05/21 00:00:00 neeri
suffixes
Revision 0.4 1993/01/31 00:00:00 neeri
Daemon
Revision 0.3 1993/01/03 00:00:00 neeri
autoSpin
Revision 0.2 1992/09/24 00:00:00 neeri
Don't include CKID, create GUSIRsrc_P.h
Revision 0.1 1992/07/13 00:00:00 neeri
.rsrc
*********************************************************************/
#include "Types.r"
#include "GUSIRsrc_P.h"
include "GUSI.rsrc" not 'ckid';
/* Define a resource ('GUI', GUSIRsrcID) to override GUSI defaults
To avoid having to change the Rez file every time I introduce another
feature, the preprocessor variable GUSI_PREF_VERSION by default keeps
everything compatible with version 1.0.2. Just define GUSI_PREF_VERSION
to be the version you want to use.
*/
#ifndef GUSI_PREF_VERSION
#define GUSI_PREF_VERSION '0102'
#endif
type 'GUI' {
literal longint text = 'TEXT'; /* Type for creat'ed files */
literal longint mpw = 'MPS '; /* Creator for creat'ed files */
byte noAutoSpin, autoSpin; /* Automatically spin cursor ? */
#if GUSI_PREF_VERSION > '0102'
boolean useChdir, dontUseChdir; /* Use chdir() ? */
boolean approxStat, accurateStat; /* statbuf.st_nlink = # of subdirectories ? */
#if GUSI_PREF_VERSION >= '0181'
boolean noDelayConsole, DelayConsole; /* Delay opening console window until needed? */
fill bit[1];
#else
boolean noTCPDaemon, isTCPDaemon; /* Inetd client ? */
boolean noUDPDaemon, isUDPDaemon;
#endif
#if GUSI_PREF_VERSION >= '0150'
#if GUSI_PREF_VERSION >= '0181'
boolean wantAppleEvents, noAppleEvents; /* Always solicit AppleEvents */
#else
boolean noConsole, hasConsole; /* Are we providing our own dev:console ? (Obsolete) */
#endif
#if GUSI_PREF_VERSION >= '0180'
boolean autoInitGraf, noAutoInitGraf; /* Automatically do InitGraf ? */
boolean exclusiveOpen, sharedOpen; /* Shared open() ? */
boolean noSigPipe, sigPipe; /* raise SIGPIPE on write to closed PIPE */
#else
fill bit[3];
#endif
#else
fill bit[4];
#endif
literal longint = GUSI_PREF_VERSION;
#if GUSI_PREF_VERSION >= '0120'
integer = $$Countof(SuffixArray);
wide array SuffixArray {
literal longint; /* Suffix of file */
literal longint; /* Type for file */
literal longint; /* Creator for file */
};
#endif
#endif
};
type 'TMPL' {
wide array {
pstring;
literal longint;
};
};
resource 'TMPL' (GUSIRsrcID, "GUI") {
{
"Type of created files", 'TNAM',
"Creator of created files", 'TNAM',
"Automatically spin cursor", 'DBYT',
#if GUSI_PREF_VERSION > '0102'
"Not using chdir()", 'BBIT',
"Accurate stat()", 'BBIT',
"TCP daemon", 'BBIT',
"UDP daemon", 'BBIT',
#if GUSI_PREF_VERSION >= '0150'
"Own Console", 'BBIT',
#else
"Reserved", 'BBIT',
#endif
#if GUSI_PREF_VERSION >= '0180'
"Don't initialize QuickDraw", 'BBIT',
"Open files shared", 'BBIT',
"Raise SIGPIPE", 'BBIT',
#else
"Reserved", 'BBIT',
"Reserved", 'BBIT',
"Reserved", 'BBIT',
#endif
"Version (don't change)", 'TNAM',
#if GUSI_PREF_VERSION >= '0120'
"NumSuffices", 'OCNT',
"*****", 'LSTC',
"Suffix", 'TNAM',
"Type for suffix", 'TNAM',
"Creator for suffix", 'TNAM',
"*****", 'LSTE',
#endif
#endif
}
};
resource 'DLOG' (GUSIRsrcID, "Get Directory") {
{0, 0, 217, 348},
dBoxProc,
invisible,
noGoAway,
0x0,
10240,
"",
alertPositionMainScreen
};
resource 'DITL' (GUSIRsrcID, "Get Directory") {
{
{ 142, 256, 160, 336}, Button {enabled,"Open"},
{1152, 59, 1232, 77}, Button {enabled,"Hidden"},
{ 193, 256, 211, 336}, Button {enabled,"Cancel"},
{ 43, 232, 63, 347}, UserItem {disabled},
{ 72, 256, 90, 336}, Button {enabled,"Eject"},
{ 97, 256, 115, 336}, Button {enabled,"Drive"},
{ 43, 12, 189, 230}, UserItem {enabled},
{ 43, 229, 189, 246}, UserItem {enabled},
{ 128, 252, 129, 340}, UserItem {disabled},
{1044, 20, 1145, 116}, StaticText {disabled,""},
{ 167, 256, 185, 336}, Button {enabled,"Directory"},
{ 0, 30, 18, 215}, Button {enabled,"Select Current Directory:"},
{ 200, 20, 1145, 222}, StaticText {disabled,"Select a Folder"}
}
};
This diff is collapsed.
This diff is collapsed.
/*********************************************************************
Project : GUSI - Grand unified socket interface
File : GUSISIOUX.cp - Interface to Metrowerks SIOUX library
Author : Matthias Neeracher
Language : MPW C/C++
$Log$
Revision 1.1 2000/09/12 20:24:49 jack
Moved to Unsupported.
Revision 1.1 1998/08/18 14:52:38 jack
Putting Python-specific GUSI modifications under CVS.
*********************************************************************/
#include <GUSIFile_P.h>
#include <ioctl.h>
#include <console.h>
#include <Events.h>
#include <LowMem.h>
/************************ SIOUXSocket members ************************/
/* This declaration lies about the return type */
extern "C" void SIOUXHandleOneEvent(EventRecord *userevent);
GUSIEvtHandler GUSISIOUXEvents[] = {
SIOUXHandleOneEvent, // nullEvent
SIOUXHandleOneEvent, // mouseDown
SIOUXHandleOneEvent, // mouseUp
nil, // keyDown
nil,
nil, // autoKey
SIOUXHandleOneEvent, // updateEvt
SIOUXHandleOneEvent, // diskEvt
SIOUXHandleOneEvent, // activateEvt
nil,
nil,
nil,
nil,
nil,
nil,
SIOUXHandleOneEvent, // osEvt
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
};
/************************ Declaration of SIOUXSocket ************************/
class SIOUXSocket : public Socket {
friend class SIOUXSocketDomain;
SIOUXSocket();
virtual ~SIOUXSocket();
protected:
int initialized;
void DoInitialize(void);
public:
virtual int read(void * buffer, int buflen);
virtual int write(void * buffer, int buflen);
virtual int select(Boolean * canRead, Boolean * canWrite, Boolean * exception);
virtual int ioctl(unsigned int request, void *argp);
virtual int isatty();
};
class SIOUXSocketDomain : public FileSocketDomain {
SIOUXSocket * singleton;
public:
SIOUXSocketDomain() : FileSocketDomain(AF_UNSPEC, true, false), singleton(nil) { }
virtual Boolean Yours(const GUSIFileRef & ref, Request request);
virtual Socket * open(const GUSIFileRef & ref, int oflag);
};
#if GENERATING68K
#pragma segment SIOUX
#endif
/************************ SIOUXSocket members ************************/
void SIOUXSocket::DoInitialize()
{
if ( initialized ) return;
initialized++;
InstallConsole(0);
GUSISetEvents(GUSISIOUXEvents);
}
SIOUXSocket::SIOUXSocket()
{
initialized = 0;
if ( !GUSIConfig.DelayConsole() )
DoInitialize();
}
SIOUXSocket::~SIOUXSocket()
{
RemoveConsole();
}
int SIOUXSocket::ioctl(unsigned int request, void *)
{
if ( !initialized) DoInitialize();
switch (request) {
case FIOINTERACTIVE:
return 0;
default:
return GUSI_error(EOPNOTSUPP);
}
}
int SIOUXSocket::read(void * buffer, int buflen)
{
if ( !initialized) DoInitialize();
fflush(stdout);
return ReadCharsFromConsole((char *) buffer, buflen);
}
int SIOUXSocket::write(void * buffer, int buflen)
{
if ( !initialized) DoInitialize();
return WriteCharsToConsole((char *) buffer, buflen);
}
static Boolean input_pending()
{
QHdrPtr eventQueue = LMGetEventQueue();
EvQElPtr element = (EvQElPtr)eventQueue->qHead;
// now, count the number of pending keyDown events.
while (element != nil) {
if (element->evtQWhat == keyDown || element->evtQWhat == autoKey)
return true;
element = (EvQElPtr)element->qLink;
}
return false;
}
int SIOUXSocket::select(Boolean * canRead, Boolean * canWrite, Boolean * exception)
{
int goodies = 0;
if ( !initialized) DoInitialize();
fflush(stdout);
if (canRead)
if (*canRead = input_pending())
++goodies;
if (canWrite) {
*canWrite = true;
++goodies;
}
if (exception)
*exception = false;
return goodies;
}
int SIOUXSocket::isatty()
{
return 1;
}
/********************* SIOUXSocketDomain members **********************/
#ifdef MSLGUSI
#ifndef SFIOGUSI
extern void GUSISetupMSLSIOUX();
#endif
#endif
extern "C" void GUSIwithSIOUXSockets()
{
static SIOUXSocketDomain SIOUXSockets;
SIOUXSockets.DontStrip();
#ifdef MSLGUSI
#ifndef SFIOGUSI
GUSISetupMSLSIOUX();
#endif
#endif
}
Boolean SIOUXSocketDomain::Yours(const GUSIFileRef & ref, FileSocketDomain::Request request)
{
if (ref.spec || (request != willOpen && request != willStat))
return false;
switch (ref.name[4] | 0x20) {
case 's':
if ((ref.name[5] | 0x20) != 't' || (ref.name[6] | 0x20) != 'd')
return false;
switch (ref.name[7] | 0x20) {
case 'i':
if ((ref.name[8] | 0x20) != 'n' || ref.name[9])
return false;
return true;
case 'o':
if ((ref.name[8] | 0x20) != 'u' || (ref.name[9] | 0x20) != 't' || ref.name[10])
return false;
return true;
case 'e':
if ((ref.name[8] | 0x20) != 'r' || (ref.name[9] | 0x20) != 'r' || ref.name[10])
return false;
return true;
default:
return false;
}
case 'c':
if ( (ref.name[5] | 0x20) != 'o' || (ref.name[6] | 0x20) != 'n'
|| (ref.name[7] | 0x20) != 's' || (ref.name[8] | 0x20) != 'o'
|| (ref.name[9] | 0x20) != 'l' || (ref.name[10] | 0x20) != 'e')
return false;
switch (ref.name[11]) {
case 0:
return true;
default:
return false;
}
default:
return false;
}
}
Socket * SIOUXSocketDomain::open(const GUSIFileRef &, int)
{
if (!singleton)
singleton = new SIOUXSocket();
++*singleton;
return singleton;
}
This diff is collapsed.
#
# MACTCP - event codes for the mactcp module
#
# UDP asr event codes
UDPDataArrival=1 # A datagram has arrived
UDPICMPReceived=2 # An ICMP error was received
# TCP asr event codes
TCPClosing=1 # All incoming data has been received and read.
TCPULPTimeout=2 # No response from remote process.
TCPTerminate=3 # Connection terminated. Has a detail parameter.
TCPDataArrival=4 # Data has arrived (and no Rcv call is outstanding)
TCPUrgent=5 # Urgent data is outstanding
TCPICMPReceived=6 # An ICMP error was received
PassiveOpenDone=32766 # (python only) a PassiveOpen has completed.
# TCP termination reasons
TCPRemoteAbort=2
TCPNetworkFailure=3
TCPSecPrecMismatch=4
TCPULPTimeoutTerminate=5
TCPULPAbort=6
TCPULPClose=7
TCPServiceError=8
# MacTCP/DNR errors
ipBadLapErr = -23000 # bad network configuration
ipBadCnfgErr = -23001 # bad IP configuration error
ipNoCnfgErr = -23002 # missing IP or LAP configuration error
ipLoadErr = -23003 # error in MacTCP load
ipBadAddr = -23004 # error in getting address
connectionClosing = -23005 # connection is closing
invalidLength = -23006
connectionExists = -23007 # request conflicts with existing connection
connectionDoesntExist = -23008 # connection does not exist
insufficientResources = -23009 # insufficient resources to perform request
invalidStreamPtr = -23010
streamAlreadyOpen = -23011
connectionTerminated = -23012
invalidBufPtr = -23013
invalidRDS = -23014
invalidWDS = -23014
openFailed = -23015
commandTimeout = -23016
duplicateSocket = -23017
# Error codes from internal IP functions
ipDontFragErr = -23032 # Packet too large to send w/o fragmenting
ipDestDeadErr = -23033 # destination not responding
icmpEchoTimeoutErr = -23035 # ICMP echo timed-out
ipNoFragMemErr = -23036 # no memory to send fragmented pkt
ipRouteErr = -23037 # can't route packet off-net
nameSyntaxErr = -23041
cacheFault = -23042
noResultProc = -23043
noNameServer = -23044
authNameErr = -23045
noAnsErr = -23046
dnrErr = -23047
outOfMemory = -23048
ipBadLapErr = -23000 # bad network configuration
ipBadCnfgErr = -23001 # bad IP configuration error
ipNoCnfgErr = -23002 # missing IP or LAP configuration error
ipLoadErr = -23003 # error in MacTCP load
ipBadAddr = -23004 # error in getting address
connectionClosing = -23005 # connection is closing
invalidLength = -23006
connectionExists = -23007 # request conflicts with existing connection
connectionDoesntExist = -23008 # connection does not exist
insufficientResources = -23009 # insufficient resources to perform request
invalidStreamPtr = -23010
streamAlreadyOpen = -23011
connectionTerminated = -23012
invalidBufPtr = -23013
invalidRDS = -23014
invalidWDS = -23014
openFailed = -23015
commandTimeout = -23016
duplicateSocket = -23017
# Error codes from internal IP functions
ipDontFragErr = -23032 # Packet too large to send w/o fragmenting
ipDestDeadErr = -23033 # destination not responding
icmpEchoTimeoutErr = -23035 # ICMP echo timed-out
ipNoFragMemErr = -23036 # no memory to send fragmented pkt
ipRouteErr = -23037 # can't route packet off-net
nameSyntaxErr = -23041
cacheFault = -23042
noResultProc = -23043
noNameServer = -23044
authNameErr = -23045
noAnsErr = -23046
dnrErr = -23047
outOfMemory = -23048
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Prototypes for mactcpglue routines and includes/structures needed
* by those.
*
* Jack Jansen, CWI, 1994.
*
* Adapted from mac socket library, which has in turn adapted from ncsa telnet.
* Original authors: Tom Milligan, Charlie Reiman
*/
#include <MacTCPCommonTypes.h>
#include <GetMyIPAddr.h>
#include <TCPPB.h>
#include <UDPPB.h>
#include <AddressXlation.h>
#ifndef __MWERKS__
#define TCPIOCompletionUPP TCPIOCompletionProc
#define TCPNotifyUPP TCPNotifyProc
#define UDPIOCompletionUPP UDPIOCompletionProc
#define UDPNotifyUPP UDPNotifyProc
#define NewTCPIOCompletionProc(x) (x)
#define NewTCPNotifyProc(x) (x)
#define NewUDPIOCompletionProc(x) (x)
#define NewUDPNotifyProc(x) (x)
#endif /* __MWERKS__ */
#if defined(powerc) || defined (__powerc)
#pragma options align=mac68k
#endif
typedef struct miniwds
{
unsigned short length;
char * ptr;
unsigned short terminus; /* must be zero'd for use */
} miniwds;
#if defined(powerc) || defined(__powerc)
#pragma options align=reset
#endif
OSErr xOpenDriver(void);
OSErr xPBControl(TCPiopb *pb, TCPIOCompletionUPP completion);
OSErr xPBControlSync(TCPiopb *pb);
OSErr xTCPCreate(int buflen, TCPNotifyUPP notify, void *udp, TCPiopb *pb);
OSErr xTCPPassiveOpen(TCPiopb *pb, short port, TCPIOCompletionUPP completion, void *udp);
OSErr xTCPActiveOpen(TCPiopb *pb, short port, long rhost, short rport, TCPIOCompletionUPP completion);
OSErr xTCPRcv(TCPiopb *pb, char *buf, int buflen, int timeout, TCPIOCompletionUPP completion);
OSErr xTCPNoCopyRcv(TCPiopb *,rdsEntry *,int,int,TCPIOCompletionUPP);
OSErr xTCPBufReturn(TCPiopb *pb,rdsEntry *rds,TCPIOCompletionUPP completion);
OSErr xTCPSend(TCPiopb *pb, wdsEntry *wds, Boolean push, Boolean urgent, TCPIOCompletionUPP completion);
OSErr xTCPClose(TCPiopb *pb,TCPIOCompletionUPP completion);
OSErr xTCPAbort(TCPiopb *pb);
OSErr xTCPRelease(TCPiopb *pb);
OSErr xUDPCreate(UDPiopb *pb,int buflen,ip_port *port, UDPNotifyUPP asr, void *udp);
OSErr xUDPRead(UDPiopb *pb,int timeout, UDPIOCompletionUPP completion);
OSErr xUDPBfrReturn(UDPiopb *pb, char *buff);
OSErr xUDPWrite(UDPiopb *pb,ip_addr host,ip_port port,miniwds *wds,
UDPIOCompletionUPP completion);
OSErr xUDPRelease(UDPiopb *pb);
ip_addr xIPAddr(void);
long xNetMask(void);
unsigned short xMaxMTU(void);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
"""Edit a file using the MetroWerks editor. Modify to suit your needs"""
import MacOS
import aetools
import Metrowerks_Shell_Suite
import Required_Suite
_talker = None
class MWShell(aetools.TalkTo,
Metrowerks_Shell_Suite.Metrowerks_Shell_Suite,
Required_Suite.Required_Suite):
pass
def edit(file, line):
global _talker
if _talker == None:
_talker = MWShell('CWIE', start=1)
try:
_talker.open(file)
_talker.Goto_Line(line)
except "(MacOS.Error, aetools.Error)":
pass
This diff is collapsed.
This diff is collapsed.
"""twit - The Window-Independent Tracer.
Interface:
twit.main() Enter debugger in inactive interactive state
twit.run(stmt, globals, locals) Enter debugger and start running stmt
twit.post_mortem(traceback) Enter debugger in post-mortem mode on traceback
twit.pm() Enter debugger in pm-mode on sys.last_traceback
main program: nothing but a bit of glue to put it all together.
Jack Jansen, CWI, August 1996."""
import os
import sys
# Add our directory to path, if needed
dirname = os.path.split(__file__)[0]
if not dirname in sys.path:
sys.path.append(dirname)
if os.name == 'mac':
import MacOS
MacOS.splash(502) # Try to show the splash screen
import mactwit_app; twit_app = mactwit_app
else:
try:
import _tkinter
have_tk = 1
except ImportError:
have_tk = 0
if have_tk:
import tktwit_app; twit_app = tktwit_app
else:
print 'Please implementent machine-dependent code and try again:-)'
sys.exit(1)
import sys
def main():
twit_app.Initialize()
if os.name == 'mac':
MacOS.splash()
twit_app.Twit('none', None)
def run(statement, globals=None, locals=None):
twit_app.Initialize()
twit_app.Twit('run', (statement, globals, locals))
def post_mortem(t):
Initialize()
twit_app.Twit('pm', t)
def pm():
post_mortem(sys.last_traceback)
if __name__ == '__main__':
main()
This diff is collapsed.
# Test program
def foo(arg1, arg2):
bar(arg1+arg2)
bar(arg1-arg2)
foo(arg1+1, arg2-1)
def bar(arg):
rv = 10/arg
print rv
foo(0,10)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment