marignotti/marignotti.h

141 lines
3.3 KiB
C
Raw Normal View History

2012-05-05 05:08:27 +00:00
#include <tcpip.h>
#include <gno/gno.h>
enum {
kCommandNone = 0,
kCommandConnect,
kCommandDisconnect,
kCommandDisconnectAndLogout,
2012-05-13 23:46:49 +00:00
kCommandAbortAndLogout,
2012-05-05 05:08:27 +00:00
kCommandRead,
kCommandWrite,
2012-05-13 23:46:49 +00:00
kCommandAccept
2012-05-05 05:08:27 +00:00
};
2012-05-12 02:47:09 +00:00
typedef void (*selwakeupfx)(int collision, int pid);
2012-05-05 05:08:27 +00:00
typedef struct Entry {
struct Entry *next;
Word ipid;
int semaphore;
srBuff sr;
Word terr;
Word command;
LongWord cookie;
LongWord timeout;
2012-05-12 02:47:09 +00:00
// select magic.
selwakeupfx select_fx;
int select_rd_pid;
int select_wr_pid;
unsigned select_rd_collision:1;
unsigned select_wr_collision:1;
2012-05-05 05:08:27 +00:00
// shutdown(2)
unsigned _SHUT_RD:1;
unsigned _SHUT_WR:1;
// fcntl(2)
unsigned _NONBLOCK:1;
//setsockopt(2)
2012-05-08 02:41:45 +00:00
unsigned _DEBUG:1;
unsigned _REUSEADDR:1;
unsigned _REUSEPORT:1;
unsigned _KEEPALIVE:1;
2012-05-05 05:08:27 +00:00
unsigned _OOBINLINE:1;
unsigned _LINGER:1;
unsigned _NOSIGPIPE:1;
2012-05-15 01:30:27 +00:00
2012-05-12 05:25:36 +00:00
Word _TYPE;
2012-05-05 05:08:27 +00:00
LongWord _SNDLOWAT;
LongWord _RCVLOWAT;
2012-05-05 19:44:54 +00:00
LongWord _RCVTIMEO;
LongWord _SNDTIMEO;
2012-05-05 05:08:27 +00:00
Word _LINGER_SEC;
} Entry;
extern Word MyID;
2012-05-12 01:21:10 +00:00
extern Word Debug;
2012-05-05 05:08:27 +00:00
typedef struct xsockaddr_in {
2012-05-12 23:43:24 +00:00
unsigned short sin_family;
2012-05-05 05:08:27 +00:00
unsigned short sin_port;
unsigned long sin_addr;
2012-05-15 01:30:27 +00:00
//unsigned char sin_zero[8];
2012-05-05 05:08:27 +00:00
} xsockaddr_in;
2012-05-12 23:43:24 +00:00
typedef struct xsockaddr {
unsigned short sa_family;
unsigned char sa_data[14];
} xsockaddr;
2012-05-05 05:08:27 +00:00
2012-05-15 01:30:27 +00:00
union xsplit {
LongWord i32;
Word i16[2];
Byte i8[4];
};
2012-05-05 05:08:27 +00:00
#define IncBusy() asm { jsl 0xE10064 }
#define DecBusy() asm { jsl 0xE10068 }
#define Resched() asm { cop 0x7f }
2012-05-08 02:41:45 +00:00
#define BusyFlag ((byte *)0xE100FFl)
2012-05-05 05:08:27 +00:00
#define SEI() asm { sei }
#define CLI() asm { cli }
int block(int sem);
2012-05-05 06:20:05 +00:00
int queue_command(Entry *e, Word command, LongWord cookie, LongWord timeout);
2012-05-05 05:08:27 +00:00
void init_table(void);
void destroy_table(void);
void process_table(void);
Entry *find_entry(Word ipid);
Entry *create_entry(Word ipid);
2012-05-15 01:30:27 +00:00
void copy_addr(xsockaddr_in *src, xsockaddr_in *dest, int *addrlen);
2012-05-05 05:08:27 +00:00
// driver stuff.
int driver(int, int, void *, void *, void *, void *, void *);
int mattach(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5);
int mread(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
2012-05-13 23:46:25 +00:00
int mreadoob(Entry *e, void *p1, void *p2, void *p3, void *p4, void *p5);
2012-05-05 05:08:27 +00:00
int mwrite(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
int mconnect(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
int mbind(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
int mdetach(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
int mdisconnect(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
2012-05-06 21:43:00 +00:00
int mshutdown(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
2012-05-05 05:08:27 +00:00
int mgetsockopt(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
int msetsockopt(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
int mioctl(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
2012-05-08 02:41:45 +00:00
int mgetsockname(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
2012-05-15 01:30:27 +00:00
int mgetpeername(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
2012-05-08 02:41:45 +00:00
int mselect(Entry *, void *p1, void *p2, void *p3, void *p4, void *p5);
2012-05-05 05:08:27 +00:00
2012-05-13 23:46:49 +00:00
int maccept(Entry *e, void *p1, void *p2, void *p3, void *p4, void *p5);
int mlisten(Entry *e, void *p1, void *p2, void *p3, void *p4, void *p5);
2012-05-05 05:08:27 +00:00