| plan 9 kernel history: overview | file list | diff list |
1998/0306/ip/ip.h (diff list | history)
| 1997/0926/sys/src/9/ip/ip.h:1,15 – 1998/0306/sys/src/9/ip/ip.h:1,19 (short | long | prev | next) | ||
| 1997/0327 |
| |
| 1997/0423 | typedef struct Ifcconv Ifcconv; | |
| 1998/0306 | typedef struct Ipself Ipself; typedef struct Iplink Iplink; typedef struct Iplifc Iplifc; typedef struct Ipmulti Ipmulti; | |
| 1997/0327 | typedef struct Iproute Iproute; | |
| 1997/0423 |
| |
| 1998/0306 | typedef struct Ipifc Ipifc; typedef struct Medium Medium; | |
| 1997/0327 | typedef struct Proto Proto; typedef struct Pstate Pstate; typedef struct Tcpc Tcpc; | |
| 1998/0306 | typedef struct Arpent Arpent; typedef struct Route Route; | |
| 1997/0327 | enum { | |
| 1997/0926/sys/src/9/ip/ip.h:18,31 – 1998/0306/sys/src/9/ip/ip.h:22,39 | ||
| 1997/0327 | Nhash= 64, Maxincall= 5, Nchans= 256, | |
| 1998/0306 | MAClen= 16, /* longest mac address */ | |
| 1997/0327 | MAXTTL= 255, | |
| 1997/0815 |
| |
| 1997/0327 |
| |
| 1997/0423 |
| |
| 1998/0306 | IPaddrlen= 16, IPv4addrlen= 4, IPv4off= 12, IPllen= 4, /* ip versions */ V4= 4, V6= 6, | |
| 1997/0327 | }; enum | |
| 1997/0926/sys/src/9/ip/ip.h:46,53 – 1998/0306/sys/src/9/ip/ip.h:54,61 | ||
| 1997/0327 | int x; /* conversation index */ Proto* p; | |
| 1998/0306 | uchar laddr[IPaddrlen]; /* local IP address */ uchar raddr[IPaddrlen]; /* remote IP address */ | |
| 1997/0327 | int restricted; /* remote port is restricted */ ushort lport; /* local port number */ ushort rport; /* remote port number */ | |
| 1997/0926/sys/src/9/ip/ip.h:77,155 – 1998/0306/sys/src/9/ip/ip.h:85,181 | ||
| 1997/0327 | QLock listenq; Rendez listenr; | |
| 1998/0306 | Ipmulti *multi; /* multicast bindings for this interface */ | |
| 1997/0327 | void* ptcl; /* protocol specific stuff */ }; | |
| 1998/0306 | struct Medium | |
| 1997/0327 | { | |
| 1998/0306 | char *name; int hsize; /* medium header size */ int minmtu; /* default min mtu */ int maxmtu; /* default max mtu */ int maclen; /* mac address length */ void (*bind)(Ipifc*, int, char**); void (*unbind)(Ipifc*); void (*bwrite)(Ipifc *ifc, Block *b, int version, uchar *ip); /* for arming interfaces to receive multicast */ void (*addmulti)(Ipifc *ifc, uchar *a, uchar *ia); void (*remmulti)(Ipifc *ifc, uchar *a, uchar *ia); /* process packets written to 'data' */ void (*pktin)(Ipifc *ifc, Block *bp); /* routes for router boards */ void (*addroute)(Ipifc *ifc, int, uchar*, uchar*, uchar*, int); void (*remroute)(Ipifc *ifc, int, uchar*, uchar*); void (*flushroutes)(Ipifc *ifc); /* for routing multicast groups */ void (*joinmulti)(Ipifc *ifc, uchar *a, uchar *ia, uchar **iap); void (*leavemulti)(Ipifc *ifc, uchar *a, uchar *ia); | |
| 1997/0327 | }; | |
| 1998/0306 | /* logical interface associated with a physical one */ struct Iplifc | |
| 1997/0327 | { | |
| 1998/0306 | uchar local[IPaddrlen]; uchar mask[IPaddrlen]; uchar remote[IPaddrlen]; uchar net[IPaddrlen]; Iplink *link; /* addresses linked to this lifc */ Iplifc *next; | |
| 1997/0327 | }; | |
| 1997/0423 |
| |
| 1998/0306 | /* binding twixt Ipself and Ipifc */ struct Iplink | |
| 1997/0423 | { | |
| 1998/0306 | Ipself *local; Iplifc *lifc; Iplink *locallink; /* next link for this local address */ Iplink *lifclink; /* next link for this ifc */ ulong expire; Iplink *next; /* free list */ | |
| 1997/0423 | int ref; | |
| 1997/0327 |
| |
| 1998/0306 | struct Ipifc | |
| 1997/0327 | { | |
| 1997/0423 |
| |
| 1997/0327 |
| |
| 1998/0306 | RWlock; Conv *conv; /* link to its conversation structure */ char dev[64]; /* device we're attached to */ Medium *m; /* Media pointer */ | |
| 1997/0327 | int maxmtu; /* Maximum transfer unit */ int minmtu; /* Minumum tranfer unit */ | |
| 1998/0306 | void *arg; /* medium specific */ /* these are used so that we can unbind on the fly */ Lock idlock; uchar ifcid; /* incremented each 'bind/unbind/add/remove' */ int ref; /* number of proc's using this ipifc */ Rendez wait; /* where unbinder waits for ref == 0 */ int unbinding; uchar mac[MAClen]; /* MAC address */ Iplifc *lifc; /* logical interfaces on this physical one */ | |
| 1997/0327 | ulong in, out; /* message statistics */ ulong inerr, outerr; /* ... */ | |
| 1998/0306 | }; | |
| 1997/0327 | ||
| 1997/0423 |
| |
| 1997/0327 |
| |
| 1998/0306 | /* * one per multicast-lifc pair used by a Conv */ struct Ipmulti { uchar ma[IPaddrlen]; uchar ia[IPaddrlen]; Ipmulti *next; | |
| 1997/0327 | }; | |
| 1997/0926 |
| |
| 1997/0327 |
| |
| 1997/0417 |
| |
| 1997/0423 |
| |
| 1997/0327 |
| |
| 1997/0423 |
| |
| 1997/0327 | /* * one per multiplexed protocol | |
| 1997/0926/sys/src/9/ip/ip.h:156,162 – 1998/0306/sys/src/9/ip/ip.h:182,188 | ||
| 1997/0327 | */ struct Proto { | |
| 1998/0306 | QLock; | |
| 1997/0327 | char* name; /* protocol name */ int x; /* protocol index */ int ipproto; /* ip protocol type */ | |
| 1997/0926/sys/src/9/ip/ip.h:164,176 – 1998/0306/sys/src/9/ip/ip.h:190,205 | ||
| 1997/0327 | void (*kick)(Conv*, int); char* (*connect)(Conv*, char**, int); | |
| 1997/0403 | char* (*announce)(Conv*, char**, int); | |
| 1997/0327 |
| |
| 1998/0306 | char* (*bind)(Conv*, char**, int); int (*state)(Conv*, char*, int); | |
| 1997/0327 | void (*create)(Conv*); void (*close)(Conv*); | |
| 1997/0423 |
| |
| 1998/0306 | void (*rcv)(uchar*, Block*); | |
| 1997/0327 | char* (*ctl)(Conv*, char**, int); void (*advise)(Block*, char*); | |
| 1997/0916 | int (*stats)(char*, int); | |
| 1998/0306 | int (*local)(Conv*, char*, int); int (*inuse)(Conv*); | |
| 1997/0327 | Conv **conv; /* array of conversations */ int ptclsize; /* size of per protocol ctl block */ | |
| 1997/0926/sys/src/9/ip/ip.h:196,211 – 1998/0306/sys/src/9/ip/ip.h:225,243 | ||
| 1997/0327 | Proto* t2p[256]; /* vector of all ip protocol handlers */ }; int Fsconnected(Fs*, Conv*, char*); | |
| 1998/0306 | Conv* Fsnewcall(Fs*, Conv*, uchar*, ushort, uchar*, ushort); | |
| 1997/0327 | int Fspcolstats(char*, int); int Fsproto(Fs*, Proto*); | |
| 1998/0306 | int Fsbuiltinproto(Fs*, uchar); | |
| 1997/0327 | Conv* Fsprotoclone(Proto*, char*); | |
| 1998/0306 | Proto* Fsrcvpcol(Fs*, uchar); | |
| 1997/0327 | char* Fsstdconnect(Conv*, char**, int); | |
| 1997/0403 | char* Fsstdannounce(Conv*, char**, int); | |
| 1998/0306 | char* Fsstdbind(Conv*, char**, int); | |
| 1997/0327 |
| |
| 1998/0306 | /* * logging */ | |
| 1997/0327 | enum { Logip= 1<<1, | |
| 1997/0926/sys/src/9/ip/ip.h:225,231 – 1998/0306/sys/src/9/ip/ip.h:257,264 | ||
| 1997/0327 | }; extern int logmask; /* mask of things to debug */ | |
| 1998/0306 | extern uchar iponly[IPaddrlen]; /* ip address to print debugging for */ extern int iponlyset; | |
| 1997/0327 | void netlogopen(void); void netlogclose(void); | |
| 1997/0926/sys/src/9/ip/ip.h:233,283 – 1998/0306/sys/src/9/ip/ip.h:266,465 | ||
| 1997/0327 | long netlogread(void*, ulong, long); void netlog(int, char*, ...); | |
| 1998/0306 | /* * iproute.c */ typedef struct RouteTree RouteTree; typedef struct Routewalk Routewalk; typedef struct V4route V4route; typedef struct V6route V6route; | |
| 1997/0327 |
| |
| 1997/0423 |
| |
| 1998/0306 | enum { | |
| 1997/0327 |
| |
| 1997/0423 |
| |
| 1997/0327 |
| |
| 1997/0903 |
| |
| 1997/0327 |
| |
| 1997/0423 |
| |
| 1997/0327 |
| |
| 1997/0423 |
| |
| 1997/0327 |
| |
| 1997/0423 |
| |
| 1997/0327 |
| |
| 1997/0926 |
| |
| 1997/0327 |
| |
| 1997/0423 |
| |
| 1997/0327 |
| |
| 1998/0306 | /* type bits */ Rv4= (1<<0), /* this is a version 4 route */ Rifc= (1<<1), /* this route is a directly connected interface */ Rptpt= (1<<2), /* this route is a pt to pt interface */ Runi= (1<<3), /* a unicast self address */ Rbcast= (1<<4), /* a broadcast self address */ Rmulti= (1<<5), /* a multicast self address */ }; | |
| 1997/0327 | ||
| 1998/0306 | struct Routewalk { int n; int o; int h; char* p; void* state; void (*walk)(Route*, Routewalk*); }; struct RouteTree { Route* right; Route* left; Route* mid; uchar depth; uchar type; uchar ifcid; /* must match ifc->id */ Ipifc *ifc; char tag[4]; }; struct V4route { ulong address; ulong endaddress; uchar gate[IPv4addrlen]; }; struct V6route { ulong address[IPllen]; ulong endaddress[IPllen]; uchar gate[IPaddrlen]; }; struct Route { RouteTree; union { V6route v6; V4route v4; }; }; extern void v4addroute(char *tag, uchar *a, uchar *mask, uchar *gate, int type); extern void v6addroute(char *tag, uchar *a, uchar *mask, uchar *gate, int type); extern void v4delroute(uchar *a, uchar *mask); extern void v6delroute(uchar *a, uchar *mask); extern Route* v4lookup(uchar *a); extern Route* v6lookup(uchar *a); extern long routeread(char*, ulong, int); extern long routewrite(Chan*, char*, int); | |
| 1997/0327 | /* | |
| 1998/0306 | * arp.c */ struct Arpent { uchar ip[IPaddrlen]; uchar mac[MAClen]; Medium *type; /* media type */ Arpent* hash; Block* hold; Block* last; uint time; uint used; uchar state; }; extern int arpread(char*, ulong, int); extern int arpwrite(char*, int); extern Arpent* arpget(Block *bp, int version, Medium *type, uchar *ip, uchar *h); extern void arprelease(Arpent *a); extern Block* arpresolve(Arpent *a, Medium *type, uchar *mac); extern void arpenter(Ipifc *ifc, int version, uchar *ip, uchar *mac, Medium *type, int norefresh); /* | |
| 1997/0327 | * ipaux.c */ | |
| 1997/0423 |
| |
| 1998/0306 | typedef struct Cmdbuf Cmdbuf; struct Cmdbuf { char buf[64]; char *f[16]; int nf; }; extern int myetheraddr(uchar*, char*); extern ulong parseip(uchar*, char*); extern ulong parseipmask(uchar*, char*); extern void maskip(uchar *from, uchar *mask, uchar *to); extern int parsemac(uchar *to, char *from, int len); extern uchar* defmask(uchar*); extern int isv4(uchar*); extern void v4tov6(uchar *v6, uchar *v4); extern int v6tov4(uchar *v4, uchar *v6); extern Cmdbuf* parsecmd(char *a, int n); extern int eipconv(va_list *arg, Fconv *f); #define ipcmp(x, y) memcmp(x, y, IPaddrlen) #define ipmove(x, y) memmove(x, y, IPaddrlen) extern uchar IPv4bcast[IPaddrlen]; extern uchar IPv4bcastobs[IPaddrlen]; extern uchar IPv4allsys[IPaddrlen]; extern uchar IPv4allrouter[IPaddrlen]; extern uchar IPnoaddr[IPaddrlen]; extern uchar v4prefix[IPaddrlen]; extern uchar IPallbits[IPaddrlen]; #define msec TK2MS(MACHP(0)->ticks) /* * media */ extern Medium ethermedium; extern Medium nullmedium; extern Medium pktmedium; extern Proto ipifc; /* * ipifc.c */ extern Medium* ipfindmedium(char *name); extern int ipforme(uchar *addr); extern int ipismulticast(uchar *); extern Ipifc* findipifc(uchar *remote, int type); extern void findlocalip(uchar *local, uchar *remote); extern int ipv4local(Ipifc *ifc, uchar *addr); extern int ipv6local(Ipifc *ifc, uchar *addr); extern Iplifc* iplocalonifc(Ipifc *ifc, uchar *ip); extern int ipproxyifc(Ipifc *ifc, uchar *ip); extern int ipismulticast(uchar *ip); extern int ipisbooting(void); extern int ipifccheckin(Ipifc *ifc, Medium *med); extern void ipifccheckout(Ipifc *ifc); extern int ipifcgrab(Ipifc *ifc); extern void ipifcaddroute(int, uchar*, uchar*, uchar*, int); extern void ipifcremroute(int, uchar*, uchar*); extern void ipifcremmulti(Conv *c, uchar *ma, uchar *ia); extern void ipifcaddmulti(Conv *c, uchar *ma, uchar *ia); extern char* ipifcrem(Ipifc *ifc, char **argv, int argc, int dolock); extern char* ipifcadd(Ipifc *ifc, char **argv, int argc); /* * ip.c */ extern void closeifcconv(Ifcconv*); extern void icmpnoconv(Block*); extern void initfrag(int); extern ushort ipcsum(uchar*); extern void (*ipextprotoiput)(Block*); extern void ipiput(uchar*, Block*); extern void ipoput(Block*, int, int); extern int ipstats(char*, int); extern uchar* logctl(uchar*); extern Ifcconv* newifcconv(void); extern void (*pktifcrcv)(Conv*, Block*); extern ushort ptclbsum(uchar*, int); extern ushort ptclcsum(Block*, int, int); /* * iprouter.c */ void useriprouter(uchar*, Block*); void iprouteropen(void); void iprouterclose(void); long iprouterread(void*, int); /* * global to all of the stack */ extern int debug; extern Fs fs; extern int iprouting; /* true if routing turned on */ extern void (*igmpreportfn)(Ipifc*, uchar*); | |