## diffname ip/ip.h 1997/0327
## diff -e /dev/null /n/emeliedump/1997/0327/sys/src/brazil/ip/ip.h
0a
typedef ulong Ipaddr;
typedef uchar byte;
typedef struct Conv Conv;
typedef struct Fs Fs;
typedef union Hwaddr Hwaddr;
typedef struct Iproute Iproute;
typedef struct Media Media;
typedef struct Proto Proto;
typedef struct Pstate Pstate;
typedef struct Tcpc Tcpc;
enum
{
Addrlen= 64,
Maxproto= 20,
Nhash= 64,
Maxincall= 5,
Nchans= 256,
MAXTTL= 255,
Ipbcast= 0xffffffff, /* ip broadcast address */
Ipbcastobs= 0, /* obsolete (but still used) ip broadcast addr */
};
enum
{
Announcing= 1,
Announced= 2,
Connecting= 3,
Connected= 4,
};
/*
* contained in each conversation
*/
struct Conv
{
Lock;
int x; /* conversation index */
Proto* p;
Ipaddr laddr; /* local IP address */
Ipaddr raddr; /* remote IP address */
int restricted; /* remote port is restricted */
ushort lport; /* local port number */
ushort rport; /* remote port number */
uint ttl; /* max time to live */
char owner[NAMELEN]; /* protections */
int perm;
int inuse; /* opens of listen/data/ctl */
int length;
int state;
/* udp specific */
int headers; /* data src/dst headers in udp */
int reliable; /* true if reliable udp */
Conv* incall; /* calls waiting to be listened for */
Conv* next;
Queue* rq; /* queued data waiting to be read */
Queue* wq; /* queued data waiting to be written */
Queue* eq; /* returned error packets */
QLock car;
Rendez cr;
char cerr[ERRLEN];
QLock listenq;
Rendez listenr;
void* ptcl; /* protocol specific stuff */
};
union Hwaddr
{
byte ether[6];
};
enum
{
METHER, /* Media types */
MFDDI,
MPACKET,
};
struct Media
{
int type; /* Media type */
Chan* mchan; /* Data channel */
Chan* achan; /* Arp channel */
char* dev; /* device mfd points to */
Ipaddr myip[5];
Ipaddr mymask;
Ipaddr mynetmask;
Ipaddr remip; /* Address of remote side */
byte netmyip[4]; /* In Network byte order */
int arping; /* true if we mus arp */
int maxmtu; /* Maximum transfer unit */
int minmtu; /* Minumum tranfer unit */
int hsize; /* Media header size */
Hwaddr;
ulong in, out; /* message statistics */
ulong inerr, outerr; /* ... */
int inuse;
Conv *c; /* for packet interface */
Media* link;
};
int Mediaforme(byte*);
int Mediaforpt2pt(byte*);
Ipaddr Mediagetsrc(byte*);
void Mediaclose(Media*);
char* Mediaopen(int, char*, Conv*, Ipaddr, Ipaddr, Ipaddr, int, Media**);
Media* Mediaroute(byte*, byte*);
void Mediasetaddr(Media*, Ipaddr, Ipaddr);
void Mediasetraddr(Media*, Ipaddr);
Ipaddr Mediagetaddr(Media*);
Ipaddr Mediagetraddr(Media*);
void Mediawrite(Media*, Block*, byte*);
int Mediaifcread(byte*, ulong, int);
char* Mediaifcwrite(char*, int);
void Mediaresolver(Media*);
void Mediaread(Media*);
int Mediaarp(Media*, Block*, byte*, Hwaddr*);
Media* Mediafind(Iproute*);
/*
* one per multiplexed protocol
*/
struct Proto
{
Lock;
char* name; /* protocol name */
int x; /* protocol index */
int ipproto; /* ip protocol type */
void (*kick)(Conv*, int);
char* (*connect)(Conv*, char**, int);
void (*announce)(Conv*);
int (*state)(char**, Conv*);
void (*create)(Conv*);
void (*close)(Conv*);
void (*rcv)(Block*);
char* (*ctl)(Conv*, char**, int);
void (*advise)(Block*, char*);
Conv **conv; /* array of conversations */
int ptclsize; /* size of per protocol ctl block */
int nc; /* number of conversations */
int ac;
Qid qid; /* qid for protocol directory */
ushort nextport;
ushort nextrport;
ulong csumerr; /* checksum errors */
ulong hlenerr; /* header length error */
ulong lenerr; /* short packet */
ulong order; /* out of order */
ulong rexmit; /* retransmissions */
};
struct Fs
{
Lock;
int np;
Proto* p[Maxproto+1]; /* list of supported protocols */
Proto* t2p[256]; /* vector of all ip protocol handlers */
};
int Fsconnected(Fs*, Conv*, char*);
Conv* Fsnewcall(Fs*, Conv*, Ipaddr, ushort, Ipaddr, ushort);
int Fspcolstats(char*, int);
int Fsproto(Fs*, Proto*);
int Fsbuiltinproto(Fs*, byte);
Conv* Fsprotoclone(Proto*, char*);
Proto* Fsrcvpcol(Fs*, byte);
char* Fsstdconnect(Conv*, char**, int);
/* log flags */
enum
{
Logip= 1<<1,
Logtcp= 1<<2,
Logfs= 1<<3,
Logil= 1<<4,
Logicmp= 1<<5,
Logudp= 1<<6,
Logcompress= 1<<7,
Logilmsg= 1<<8,
Loggre= 1<<9,
Logppp= 1<<10,
Logtcpmsg= 1<<11,
};
extern int logmask; /* mask of things to debug */
extern Ipaddr iponly; /* ip address to print debugging for */
void netlogopen(void);
void netlogclose(void);
char* netlogctl(char*, int);
long netlogread(void*, ulong, long);
void netlog(int, char*, ...);
#define msec TK2MS(MACHP(0)->ticks)
/* Globals */
extern int debug;
extern Fs fs;
extern Media* media;
extern int iprouting; /* true if routing turned on */
int arpread(byte*, ulong, int);
char* arpwrite(char*, int);
Ipaddr defmask(Ipaddr);
int eipconv(va_list*, Fconv*);
int equivip(byte*, byte*);
void fatal(byte*, ...);
void hnputl(byte*, ulong);
void hnputs(byte*, ushort);
void initfrag(int);
ushort ipcsum(byte*);
void (*ipextprotoiput)(Block*);
Ipaddr ipgetsrc(byte*);
void ipiput(Block*);
void ipoput(Block*, int, int);
int ipstats(char*, int);
byte* logctl(byte*);
void maskip(byte*, byte*, byte*);
ulong nhgetl(byte*);
ushort nhgets(byte*);
void (*pktifcrcv)(Conv*, Block*);
ushort ptclcsum(Block*, int, int);
int pullblock(Block**, int);
Block* pullupblock(Block*, int);
char* routeadd(Ipaddr, Ipaddr, Ipaddr);
void routedelete(ulong, ulong);
int routeread(byte*, ulong, int);
char* routewrite(char*, int);
/*
* ipaux.c
*/
int myetheraddr(uchar*, char*);
ulong parseip(char*, char*);
.
## diffname ip/ip.h 1997/0403
## diff -e /n/emeliedump/1997/0327/sys/src/brazil/ip/ip.h /n/emeliedump/1997/0403/sys/src/brazil/ip/ip.h
181a
char* Fsstdannounce(Conv*, char**, int);
.
143c
char* (*announce)(Conv*, char**, int);
.
## diffname ip/ip.h 1997/0417
## diff -e /n/emeliedump/1997/0403/sys/src/brazil/ip/ip.h /n/emeliedump/1997/0417/sys/src/brazil/ip/ip.h
124c
int Mediaifcread(char*, ulong, int);
.
## diffname ip/ip.h 1997/0423
## diff -e /n/emeliedump/1997/0417/sys/src/brazil/ip/ip.h /n/emeliedump/1997/0423/sys/src/brazil/ip/ip.h
249c
ulong parseip(uchar*, char*);
.
240,241c
char* routeadd(Ipaddr, Ipaddr, Ipaddr, Media *m);
void routedelete(ulong, ulong, Media *m);
.
233a
Ifcconv* newifcconv(void);
.
231a
int ismcast(byte*);
int isbmcast(byte*);
.
229c
void ipiput(Media*, Block*);
.
218a
void closeifcconv(Ifcconv*);
.
215a
extern void (*igmpreportfn)(Media*, byte*);
.
197a
Logigmp= 1<<12,
.
147c
void (*rcv)(Media*, Block*);
.
129a
Multicast* Mediacopymulti(Media*);
void Mediamulticastadd(Media*, Ifcconv*, Ipaddr);
void Mediamulticastrem(Media*, Ipaddr);
.
125c
char* Mediaifcwrite(Ifcconv*, char*, int);
.
110a
QLock mlock; /* lock for changing *multi */
Multicast *multi; /* list of multicast addresses we're listening to */
int mactive; /* number of active multicast addresses */
.
94a
Chan* cchan; /* Control channel */
.
89a
/* one per multicast address per medium */
struct Multicast
{
Ipaddr addr;
int ref;
int timeout;
Multicast *next;
};
.
23a
Ipallsys= 0xe0000001, /* multicast for all systems */
Ipallrouter= 0xe0000002, /* multicast for all routers */
.
21a
Ipaddrlen= 4,
.
7a
typedef struct Multicast Multicast;
.
5a
typedef struct Ifcconv Ifcconv;
.
## diffname ip/ip.h 1997/0806
## diff -e /n/emeliedump/1997/0423/sys/src/brazil/ip/ip.h /n/emeliedump/1997/0806/sys/src/brazil/ip/ip.h
220a
Logudpmsg= 1<<13,
Logipmsg= 1<<14,
.
185a
ulong wclosed; /* window closed */
.
## diffname ip/ip.h 1997/0815
## diff -e /n/emeliedump/1997/0806/sys/src/brazil/ip/ip.h /n/emeliedump/1997/0815/sys/src/brazil/ip/ip.h
24c
IPaddrlen= 4,
.
## diffname ip/ip.h 1997/0903
## diff -e /n/emeliedump/1997/0815/sys/src/brazil/ip/ip.h /n/emeliedump/1997/0903/sys/src/brazil/ip/ip.h
252a
void icmpnoconv(Block*);
.
## diffname ip/ip.h 1997/0916
## diff -e /n/emeliedump/1997/0903/sys/src/brazil/ip/ip.h /n/emeliedump/1997/0916/sys/src/brazil/ip/ip.h
186d
171a
int (*stats)(char*, int);
.
## diffname ip/ip.h 1997/0926
## diff -e /n/emeliedump/1997/0916/sys/src/brazil/ip/ip.h /n/emeliedump/1997/0926/sys/src/brazil/ip/ip.h
268a
ushort ptclbsum(byte*, int);
.
131a
int Mediabooting(void);
.
## diffname ip/ip.h 1998/0306
## diff -e /n/emeliedump/1997/0926/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0306/sys/src/brazil/ip/ip.h
282,283c
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*);
.
279a
* 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);
/*
.
278a
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);
.
245,277c
/* 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 */
};
.
238,243c
enum
{
.
236c
/*
* iproute.c
*/
typedef struct RouteTree RouteTree;
typedef struct Routewalk Routewalk;
typedef struct V4route V4route;
typedef struct V6route V6route;
.
228c
extern uchar iponly[IPaddrlen]; /* ip address to print debugging for */
extern int iponlyset;
.
208c
/*
* logging
*/
.
206a
char* Fsstdbind(Conv*, char**, int);
.
204c
Proto* Fsrcvpcol(Fs*, uchar);
.
202c
int Fsbuiltinproto(Fs*, uchar);
.
199c
Conv* Fsnewcall(Fs*, Conv*, uchar*, ushort, uchar*, ushort);
.
173a
int (*local)(Conv*, char*, int);
int (*inuse)(Conv*);
.
170c
void (*rcv)(uchar*, Block*);
.
167c
char* (*bind)(Conv*, char**, int);
int (*state)(Conv*, char*, int);
.
159c
QLock;
.
132,152d
126,130c
/*
* one per multicast-lifc pair used by a Conv
*/
struct Ipmulti
{
uchar ma[IPaddrlen];
uchar ia[IPaddrlen];
Ipmulti *next;
.
123,124c
};
.
119,120c
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 */
.
106,116c
RWlock;
Conv *conv; /* link to its conversation structure */
char dev[64]; /* device we're attached to */
Medium *m; /* Media pointer */
.
104c
struct Ipifc
.
100,101d
98c
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 */
.
95,96c
/* binding twixt Ipself and Ipifc */
struct Iplink
.
90,92c
uchar local[IPaddrlen];
uchar mask[IPaddrlen];
uchar remote[IPaddrlen];
uchar net[IPaddrlen];
Iplink *link; /* addresses linked to this lifc */
Iplifc *next;
.
88c
/* logical interface associated with a physical one */
struct Iplifc
.
85c
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);
.
83c
struct Medium
.
79a
Ipmulti *multi; /* multicast bindings for this interface */
.
49,50c
uchar laddr[IPaddrlen]; /* local IP address */
uchar raddr[IPaddrlen]; /* remote IP address */
.
24,28c
IPaddrlen= 16,
IPv4addrlen= 4,
IPv4off= 12,
IPllen= 4,
/* ip versions */
V4= 4,
V6= 6,
.
20a
MAClen= 16, /* longest mac address */
.
12a
typedef struct Arpent Arpent;
typedef struct Route Route;
.
8,9c
typedef struct Ipifc Ipifc;
typedef struct Medium Medium;
.
6a
typedef struct Ipself Ipself;
typedef struct Iplink Iplink;
typedef struct Iplifc Iplifc;
typedef struct Ipmulti Ipmulti;
.
1,2d
## diffname ip/ip.h 1998/0307
## diff -e /n/emeliedump/1998/0306/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0307/sys/src/brazil/ip/ip.h
137c
Iplink *selflink; /* next link for this local address */
.
135c
Ipself *self;
.
118a
int unbindonclose; /* if non-zero, unbind on last close */
.
## diffname ip/ip.h 1998/0310
## diff -e /n/emeliedump/1998/0307/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0310/sys/src/brazil/ip/ip.h
434a
extern long ipselftabread(char *a, ulong offset, int n);
.
342a
extern void routetype(int, char*);
.
## diffname ip/ip.h 1998/0313
## diff -e /n/emeliedump/1998/0310/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0313/sys/src/brazil/ip/ip.h
458,461c
void useriprouter(Fs*, uchar*, Block*);
void iprouteropen(Fs*);
void iprouterclose(Fs*);
long iprouterread(Fs*, void*, int);
/*
* resolving inferno/plan9 differences
*/
Chan* commonfdtochan(int, int, int, int);
char* commonuser(void);
char* commonerror(void);
.
455a
* bootp.c
*/
extern char* bootp(Ipifc*);
extern int bootpread(char*, ulong, int);
/*
.
453a
extern void ip_init(Fs*);
.
450,451d
446,448c
extern void ipiput(Fs*, uchar*, Block*);
extern void ipoput(Fs*, Block*, int, int);
extern int ipstats(Fs*, char*, int);
.
442,443c
extern void icmpnoconv(Fs*, Block*);
extern void initfrag(IP*, int);
.
436c
extern long ipselftabread(Fs*, char *a, ulong offset, int n);
.
430,431c
extern void ipifcaddroute(Fs*, int, uchar*, uchar*, uchar*, int);
extern void ipifcremroute(Fs*, int, uchar*, uchar*);
.
424c
extern int ipproxyifc(Fs *f, Ipifc *ifc, uchar *ip);
.
419,420c
extern Ipifc* findipifc(Fs*, uchar *remote, int type);
extern void findlocalip(Fs*, uchar *local, uchar *remote);
.
417c
extern int ipforme(Fs*, uchar *addr);
.
410a
extern Medium tripmedium;
.
361,366c
extern void arpinit(Fs*);
extern int arpread(Arp*, char*, ulong, int);
extern int arpwrite(Arp*, char*, int);
extern Arpent* arpget(Arp*, Block *bp, int version, Medium *type, uchar *ip, uchar *h);
extern void arprelease(Arp*, Arpent *a);
extern Block* arpresolve(Arp*, Arpent *a, Medium *type, uchar *mac);
extern void arpenter(Arp*, Ipifc *ifc, int version, uchar *ip, uchar *mac, Medium *type, int norefresh);
.
343a
extern void ipwalkroutes(Fs*, Routewalk*);
extern void convroute(Route*, uchar*, uchar*, uchar*, char*, int*);
.
335,342c
extern void v4addroute(Fs *f, char *tag, uchar *a, uchar *mask, uchar *gate, int type);
extern void v6addroute(Fs *f, char *tag, uchar *a, uchar *mask, uchar *gate, int type);
extern void v4delroute(Fs *f, uchar *a, uchar *mask);
extern void v6delroute(Fs *f, uchar *a, uchar *mask);
extern Route* v4lookup(Fs *f, uchar *a);
extern Route* v6lookup(Fs *f, uchar *a);
extern long routeread(Fs *f, char*, ulong, int);
extern long routewrite(Fs *f, Chan*, char*, int);
.
265,270d
261,263c
void netloginit(Fs*);
void netlogopen(Fs*);
void netlogclose(Fs*);
char* netlogctl(Fs*, char*, int);
long netlogread(Fs*, void*, ulong, long);
void netlog(Fs*, int, char*, ...);
.
229,230c
int Fsconnected(Conv*, char*);
Conv* Fsnewcall(Conv*, uchar*, ushort, uchar*, ushort);
.
227a
Proto* ipifc; /* kludge for ipifcremroute & ipifcaddroute */
IP *ip;
Ipselftab *self;
Arp *arp;
IProuter iprouter;
Route *v4root[1<<Lroot]; /* v4 routing forest */
Route *v6root[1<<Lroot]; /* v6 routing forest */
Route *queue; /* used as temp when reinjecting routes */
Log *alog;
.
220a
/*
* Stream for sending packets to user level
*/
struct IProuter {
QLock;
int opens;
Queue *q;
};
/*
* one per IP protocol stack
*/
.
214,218c
void *priv;
.
205a
Fs *f; /* file system this proto is part of */
.
201,202c
void (*advise)(Proto*, Block*, char*);
int (*stats)(Proto*, char*, int);
.
199c
void (*rcv)(Proto*, uchar*, Block*);
.
117c
void (*joinmulti)(Ipifc *ifc, uchar *a, uchar *ia);
.
109c
void (*pktin)(Fs *f, Ipifc *ifc, Block *bp);
.
36a
/* 2^Lroot trees in the root table */
Lroot = 10,
.
15a
typedef struct Arp Arp;
.
10a
typedef struct Log Log;
.
9a
typedef struct IProuter IProuter;
.
5a
typedef struct Ipselftab Ipselftab;
.
4a
typedef struct IP IP;
.
## diffname ip/ip.h 1998/0314
## diff -e /n/emeliedump/1998/0313/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0314/sys/src/brazil/ip/ip.h
511d
471a
extern void iprouting(Fs*, int);
.
442d
## diffname ip/ip.h 1998/0316
## diff -e /n/emeliedump/1998/0314/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0316/sys/src/brazil/ip/ip.h
11d
## diffname ip/ip.h 1998/0324
## diff -e /n/emeliedump/1998/0316/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0324/sys/src/brazil/ip/ip.h
244a
Proto* ipmux; /* kludge for finding an ip multiplexor */
.
243a
Ipmux* t2m[256]; /* vector of all ip multiplexors */
.
10a
typedef struct Ipmux Ipmux;
.
## diffname ip/ip.h 1998/0325
## diff -e /n/emeliedump/1998/0324/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0325/sys/src/brazil/ip/ip.h
240c
RWlock;
.
## diffname ip/ip.h 1998/0327
## diff -e /n/emeliedump/1998/0325/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0327/sys/src/brazil/ip/ip.h
244,245c
Proto* t2p[256]; /* vector of all protocols */
.
## diffname ip/ip.h 1998/0328
## diff -e /n/emeliedump/1998/0327/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0328/sys/src/brazil/ip/ip.h
413a
extern char* v4parseip(uchar*, char*);
.
## diffname ip/ip.h 1998/0423
## diff -e /n/emeliedump/1998/0328/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0423/sys/src/brazil/ip/ip.h
448a
extern void addipmedium(Medium *med);
.
## diffname ip/ip.h 1998/0509
## diff -e /n/emeliedump/1998/0423/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0509/sys/src/brazil/ip/ip.h
266a
Proto* Fsrcvpcolx(Fs*, uchar);
.
## diffname ip/ip.h 1998/0630
## diff -e /n/emeliedump/1998/0509/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0630/sys/src/brazil/ip/ip.h
398c
extern void arpenter(Fs*, int version, uchar *ip, uchar *mac, int len, int norefresh);
.
394c
extern int arpwrite(Fs*, char*, int);
.
366,367c
extern void v4delroute(Fs *f, uchar *a, uchar *mask, int dolock);
extern void v6delroute(Fs *f, uchar *a, uchar *mask, int dolock);
.
290a
Logrudp= 1<<15,
Logrudpmsg= 1<<16,
.
127a
void (*ares)(Fs*, int, uchar*, uchar*, int, int);
.
## diffname ip/ip.h 1998/0728
## diff -e /n/emeliedump/1998/0630/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0728/sys/src/brazil/ip/ip.h
456a
extern int ipisbm(uchar *);
.
## diffname ip/ip.h 1998/0813
## diff -e /n/emeliedump/1998/0728/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0813/sys/src/brazil/ip/ip.h
483a
extern void icmpttlexceeded(Fs*, uchar*, Block*);
.
## diffname ip/ip.h 1998/0815
## diff -e /n/emeliedump/1998/0813/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0815/sys/src/brazil/ip/ip.h
325c
struct Routewalk
{
.
## diffname ip/ip.h 1998/0924
## diff -e /n/emeliedump/1998/0815/sys/src/brazil/ip/ip.h /n/emeliedump/1998/0924/sys/src/brazil/ip/ip.h
242a
int dev;
.
## diffname ip/ip.h 1998/1005
## diff -e /n/emeliedump/1998/0924/sys/src/brazil/ip/ip.h /n/emeliedump/1998/1005/sys/src/brazil/ip/ip.h
461a
extern void findprimaryip(Fs*, uchar*);
.
## diffname ip/ip.h 1998/1118
## diff -e /n/emeliedump/1998/1005/sys/src/brazil/ip/ip.h /n/emeliedump/1998/1118/sys/src/brazil/ip/ip.h
304a
void ifcloginit(Fs*);
long ifclogread(Fs*, Chan *,void*, ulong, long);
void ifclog(Fs*, uchar *, int);
void ifclogopen(Fs*, Chan*);
void ifclogclose(Fs*, Chan*);
.
260a
Ifclog *ilog;
.
14a
typedef struct Ifclog Ifclog;
.
## diffname ip/ip.h 1999/0302
## diff -e /n/emeliedump/1998/1118/sys/src/brazil/ip/ip.h /n/emeliedump/1999/0302/sys/src/brazil/ip/ip.h
61c
QLock;
.
## diffname ip/ip.h 1999/0316
## diff -e /n/emeliedump/1999/0302/sys/src/brazil/ip/ip.h /n/emeliedump/1999/0316/sys/src/brazil/ip/ip.h
501d
436d
418,425d
298c
Logesp= 1<<17,
.
261c
Netlog *alog;
.
214a
int (*remote)(Conv*, char*, int);
.
14c
typedef struct Netlog Netlog;
.
## diffname ip/ip.h 1999/0731
## diff -e /n/emeliedump/1999/0316/sys/src/brazil/ip/ip.h /n/emeliedump/1999/0731/sys/src/brazil/ip/ip.h
129c
/* address resolution */
void (*ares)(Fs*, int, uchar*, uchar*, int, int); /* resolve */
void (*areg)(Ipifc*, uchar*); /* register */
.
## diffname ip/ip.h 1999/0817
## diff -e /n/emeliedump/1999/0731/sys/src/brazil/ip/ip.h /n/emeliedump/1999/0817/sys/src/brazil/ip/ip.h
493c
extern void ipoput(Fs*, Block*, int, int, int);
.
71a
uint tos; /* type of service */
.
33a
DFLTTOS= 0,
.
## diffname ip/ip.h 1999/0909
## diff -e /n/emeliedump/1999/0817/sys/src/brazil/ip/ip.h /n/emeliedump/1999/0909/sys/src/brazil/ip/ip.h
335a
Rproxy= (1<<6), /* this route should be proxied */
.
## diffname ip/ip.h 1999/0910
## diff -e /n/emeliedump/1999/0909/sys/src/brazil/ip/ip.h /n/emeliedump/1999/0910/sys/src/brazil/ip/ip.h
281c
void closeconv(Conv*);
.
## diffname ip/ip.h 2000/0116
## diff -e /n/emeliedump/1999/0910/sys/src/brazil/ip/ip.h /n/emeliedump/2000/0116/sys/src/9/ip/ip.h
267a
char ndb[1024]; /* an ndb entry for this interface */
.
## diffname ip/ip.h 2000/0220
## diff -e /n/emeliedump/2000/0116/sys/src/9/ip/ip.h /n/emeliedump/2000/0220/sys/src/9/ip/ip.h
509,516d
260d
235,243d
## diffname ip/ip.h 2000/0329
## diff -e /n/emeliedump/2000/0220/sys/src/9/ip/ip.h /n/emeliedump/2000/0329/sys/src/9/ip/ip.h
486d
## diffname ip/ip.h 2000/0424
## diff -e /n/emeliedump/2000/0329/sys/src/9/ip/ip.h /n/emeliedump/2000/0424/sys/src/9/ip/ip.h
220a
int (*gc)(Proto*); /* returns true if any conversations are freed */
.
30c
Nchans= 512,
.
## diffname ip/ip.h 2000/1111
## diff -e /n/emeliedump/2000/0424/sys/src/9/ip/ip.h /n/emeliedump/2000/1111/sys/src/9/ip/ip.h
507a
* chandial.c
*/
extern Chan* chandial(char*, char*, char*, Chan**);
/*
.
## diffname ip/ip.h 2000/1220
## diff -e /n/emeliedump/2000/1111/sys/src/9/ip/ip.h /n/emeliedump/2000/1220/sys/src/9/ip/ip.h
50a
Idle= 0,
.
## diffname ip/ip.h 2001/0124
## diff -e /n/emeliedump/2000/1220/sys/src/9/ip/ip.h /n/emeliedump/2001/0124/sys/src/9/ip/ip.h
150c
/* binding twixt Ipself and Iplifc */
.
## diffname ip/ip.h 2001/0301
## diff -e /n/emeliedump/2001/0124/sys/src/9/ip/ip.h /n/emeliedump/2001/0301/sys/src/9/ip/ip.h
196a
/*
* hash table for 2 ip addresses + 2 ports
*/
enum
{
Nipht= 521, /* convenient prime */
IPmatchexact= 0, /* match on 4 tuple */
IPmatchany, /* *!* */
IPmatchport, /* *!port */
IPmatchaddr, /* addr!* */
IPmatchpa, /* addr!port */
};
struct Iphash
{
Iphash *next;
Conv *c;
int match;
};
struct Ipht
{
Lock;
Iphash *tab[Nipht];
};
void iphtadd(Ipht*, Conv*);
void iphtrem(Ipht*, Conv*);
Conv* iphtlook(Ipht *ht, uchar *sa, ushort sp, uchar *da, ushort dp);
.
13a
typedef struct Iphash Iphash;
typedef struct Ipht Ipht;
.
## diffname ip/ip.h 2001/0306
## diff -e /n/emeliedump/2001/0301/sys/src/9/ip/ip.h /n/emeliedump/2001/0306/sys/src/9/ip/ip.h
238c
void (*kick)(Conv*);
.
## diffname ip/ip.h 2001/0405
## diff -e /n/emeliedump/2001/0306/sys/src/9/ip/ip.h /n/emeliedump/2001/0405/sys/src/9/ip/ip.h
418a
/*
* devip.c
*/
/*
* Hanging off every ip channel's ->aux is the following structure.
* It maintains the state used by devip and iproute.
*/
struct IPaux
{
char owner[NAMELEN]; /* the user that did the attach */
char tag[4];
};
extern IPaux* newipaux(char*, char*);
.
5a
typedef struct IPaux IPaux;
.
## diffname ip/ip.h 2001/0527
## diff -e /n/emeliedump/2001/0405/sys/src/9/ip/ip.h /n/emeliedump/2001/0527/sys/src/9/ip/ip.h
431c
char *owner; /* the user that did the attach */
.
98c
char cerr[ERRMAX];
.
79c
char *owner ; /* protections */
.
49a
Maxpath = 64,
.
## diffname ip/ip.h 2001/0623
## diff -e /n/emeliedump/2001/0527/sys/src/9/ip/ip.h /n/emeliedump/2001/0623/sys/src/9/ip/ip.h
537c
extern void ipiput(Fs*, Ipifc*, Block*);
.
534c
extern void icmpttlexceeded(Fs*, Ipifc*, Block*);
.
248c
void (*rcv)(Proto*, Ipifc*, Block*);
.
## diffname ip/ip.h 2001/0710
## diff -e /n/emeliedump/2001/0623/sys/src/9/ip/ip.h /n/emeliedump/2001/0710/sys/src/9/ip/ip.h
385a
int ref;
.
## diffname ip/ip.h 2001/0922
## diff -e /n/emeliedump/2001/0710/sys/src/9/ip/ip.h /n/emeliedump/2001/0922/sys/src/9/ip/ip.h
308a
.
307a
ulong scalednconv(void);
.
## diffname ip/ip.h 2001/1117
## diff -e /n/emeliedump/2001/0922/sys/src/9/ip/ip.h /n/emeliedump/2001/1117/sys/src/9/ip/ip.h
545a
extern void update_mtucache(uchar*, ulong);
extern ulong restrict_mtu(uchar*, ulong);
.
176a
int reassemble; /* reassemble IP packets before forwarding */
.
## diffname ip/ip.h 2001/1120
## diff -e /n/emeliedump/2001/1117/sys/src/9/ip/ip.h /n/emeliedump/2001/1120/sys/src/9/ip/ip.h
339c
void netlogctl(Fs*, char*, int);
.
## diffname ip/ip.h 2002/0217
## diff -e /n/emeliedump/2001/1120/sys/src/9/ip/ip.h /n/emeliedump/2002/0217/sys/src/9/ip/ip.h
481c
extern int eipfmt(Fmt*);
.
## diffname ip/ip.h 2002/0324
## diff -e /n/emeliedump/2002/0217/sys/src/9/ip/ip.h /n/emeliedump/2002/0324/sys/src/9/ip/ip.h
295a
int ndbvers;
.
## diffname ip/ip.h 2002/0325
## diff -e /n/emeliedump/2002/0324/sys/src/9/ip/ip.h /n/emeliedump/2002/0325/sys/src/9/ip/ip.h
296a
long ndbmtime;
.
## diffname ip/ip.h 2002/0507
## diff -e /n/emeliedump/2002/0325/sys/src/9/ip/ip.h /n/emeliedump/2002/0507/sys/src/9/ip/ip.h
575a
.
551d
543,544c
extern void ipiput4(Fs*, Ipifc*, Block*);
extern void ipiput6(Fs*, Ipifc*, Block*);
extern void ipoput4(Fs*, Block*, int, int, int);
extern void ipoput6(Fs*, Block*, int, int, int);
.
540,541c
extern void icmpttlexceeded(Fs*, uchar*, Block*);
.
533c
extern char* ipifcaddgate6(Fs *f, Ipifc *ifc, char**argv, int argc);
extern char* ipifcaddpref6(Ipifc *ifc, char**argv, int argc);
extern void ipsendra6(Fs *f, int on);
extern long ipgateread6(Fs *f, char *cp, ulong offset, int n);
.
531c
extern char* ipifcadd(Ipifc *ifc, char **argv, int argc, int tentative, Iplifc *lifcp);
.
518a
extern int ipv6anylocal(Ipifc *ifc, uchar *addr);
.
511a
extern int iptentative(Fs*, uchar *addr);
.
464c
extern Arpent* arpget(Arp*, Block *bp, int version, Ipifc *ifc, uchar *ip, uchar *h);
.
458a
Arpent *nextrxt; /* re-transmit chain */
uint rxtat;
uchar rxtsrem;
Ipifc *ifc;
uchar ifcid; /* must match ifc->id */
.
452c
Medium *type; /* media type */
.
313d
299a
/* one per default router known to host */
struct v6router {
uchar inuse;
Ipifc *ifc;
int ifcid;
uchar routeraddr[IPaddrlen];
long ltorigin;
Routerparams rp;
};
struct v6params
{
Routerparams rp; /* v6 params, one copy per node now */
Hostparams hp;
v6router v6rlist[3]; /* max 3 default routers, currently */
int cdrouter; /* uses only v6rlist[cdrouter] if */
/* cdrouter >= 0. */
};
.
296,297d
286a
v6params *v6p;
.
269a
.
191a
uchar sendra6; /* == 1 => send router advs on this ifc */
uchar recvra6; /* == 1 => recv router advs on this ifc */
Routerparams rp; /* router parameters as in RFC 2461, pp.40--43.
used only if node is router */
.
166a
/* rfc 2461, pp.40--43. */
/* default values, one per stack */
struct Routerparams {
int mflag;
int oflag;
int maxraint;
int minraint;
int linkmtu;
int reachtime;
int rxmitra;
int ttl;
int routerlt;
};
struct Hostparams {
int rxmithost;
};
.
150a
uchar tentative; /* =1 => v6 dup disc on, =0 => confirmed unique */
uchar onlink; /* =1 => onlink, =0 offlink. */
uchar autoflag; /* v6 autonomous flag */
long validlt; /* v6 valid lifetime */
long preflt; /* v6 preferred lifetime */
long origint; /* time when addr was added */
.
140a
/* v6 address generation */
void (*pref2addr)(uchar *pref, uchar *ea);
.
81c
char *owner; /* protections */
.
49c
Lroot= 10,
.
46a
IP_VER4= 0x40,
IP_VER6= 0x60,
.
26a
typedef struct Routerparams Routerparams;
typedef struct Hostparams Hostparams;
typedef struct v6router v6router;
typedef struct v6params v6params;
.
## diffname ip/ip.h 2002/0514
## diff -e /n/emeliedump/2002/0507/sys/src/9/ip/ip.h /n/emeliedump/2002/0514/sys/src/9/ip/ip.h
337a
int ndbvers;
long ndbmtime;
.
## diffname ip/ip.h 2002/0601
## diff -e /n/emeliedump/2002/0514/sys/src/9/ip/ip.h /n/emeliedump/2002/0601/sys/src/9/ip/ip.h
363c
Conv* Fsnewcall(Conv*, uchar*, ushort, uchar*, ushort, uchar);
.
86a
uchar ipversion; /* IPv4 or IPv6 */
.
## diffname ip/ip.h 2002/0625
## diff -e /n/emeliedump/2002/0601/sys/src/9/ip/ip.h /n/emeliedump/2002/0625/sys/src/9/ip/ip.h
87a
int ignoreadvice; /* don't terminate connection on icmp errors */
.
## diffname ip/ip.h 2002/0710
## diff -e /n/emeliedump/2002/0625/sys/src/9/ip/ip.h /n/emeliedump/2002/0710/sys/src/9/ip/ip.h
564c
#define NOW TK2MS(MACHP(0)->ticks)
.
554a
#define ipcmp(x, y) ( (x)[IPaddrlen-1] != (y)[IPaddrlen-1] || memcmp(x, y, IPaddrlen) )
.
553d
89a
uchar ipversion;
uchar laddr[IPaddrlen]; /* local IP address */
uchar raddr[IPaddrlen]; /* remote IP address */
ushort lport; /* local port number */
ushort rport; /* remote port number */
.
87d
83,84d
80,81d
71c
* one per conversation directory
.
## diffname ip/ip.h 2002/0712
## diff -e /n/emeliedump/2002/0710/sys/src/9/ip/ip.h /n/emeliedump/2002/0712/sys/src/9/ip/ip.h
286d
## diffname ip/ip.h 2002/0713
## diff -e /n/emeliedump/2002/0712/sys/src/9/ip/ip.h /n/emeliedump/2002/0713/sys/src/9/ip/ip.h
399a
Logtcpwin= 1<<18,
.
393c
Logtcprxmt= 1<<11,
.
## diffname ip/ip.h 2002/1110
## diff -e /n/emeliedump/2002/0713/sys/src/9/ip/ip.h /n/emeliedump/2002/1110/sys/src/9/ip/ip.h
107a
Queue* sq; /* snooping queue */
Ref snoopers; /* number of processes with snoop open */
.
## diffname ip/ip.h 2002/1204
## diff -e /n/emeliedump/2002/1110/sys/src/9/ip/ip.h /n/emeliedump/2002/1204/sys/src/9/ip/ip.h
616a
extern void icmpcantfrag(Fs*, Block*);
.
## diffname ip/ip.h 2002/1207
## diff -e /n/emeliedump/2002/1204/sys/src/9/ip/ip.h /n/emeliedump/2002/1207/sys/src/9/ip/ip.h
617c
extern void icmpcantfrag(Fs*, Block*, int);
.
## diffname ip/ip.h 2003/0209
## diff -e /n/emeliedump/2002/1207/sys/src/9/ip/ip.h /n/emeliedump/2003/0209/sys/src/9/ip/ip.h
215,216c
int maxtu; /* Maximum transfer unit */
int mintu; /* Minumum tranfer unit */
int mbps; /* megabits per second */
.
127,128c
int mintu; /* default min mtu */
int maxtu; /* default max mtu */
.
## diffname ip/ip.h 2003/0220
## diff -e /n/emeliedump/2003/0209/sys/src/9/ip/ip.h /n/emeliedump/2003/0220/sys/src/9/ip/ip.h
623,624c
extern int ipoput4(Fs*, Block*, int, int, int);
extern int ipoput6(Fs*, Block*, int, int, int);
.
## diffname ip/ip.h 2003/0221
## diff -e /n/emeliedump/2003/0220/sys/src/9/ip/ip.h /n/emeliedump/2003/0221/sys/src/9/ip/ip.h
120a
Route *r; /* last route used */
ulong routegen; /* routetable generation for *r */
.
91d
## diffname ip/ip.h 2003/0304
## diff -e /n/emeliedump/2003/0221/sys/src/9/ip/ip.h /n/emeliedump/2003/0304/sys/src/9/ip/ip.h
38c
Nchans= 1024,
.
## diffname ip/ip.h 2003/0308
## diff -e /n/emeliedump/2003/0304/sys/src/9/ip/ip.h /n/emeliedump/2003/0308/sys/src/9/ip/ip.h
625,626c
extern int ipoput4(Fs*, Block*, int, int, int, Conv*);
extern int ipoput6(Fs*, Block*, int, int, int, Conv*);
.
491,492c
extern Route* v4lookup(Fs *f, uchar *a, Conv *c);
extern Route* v6lookup(Fs *f, uchar *a, Conv *c);
.
122c
ulong rgen; /* routetable generation for *r */
.
## diffname ip/ip.h 2003/0310
## diff -e /n/emeliedump/2003/0308/sys/src/9/ip/ip.h /n/emeliedump/2003/0310/sys/src/9/ip/ip.h
530c
uint rtime; /* time for next retransmission */
.
526,527c
uint ctime; /* time entry was created or refreshed */
uint utime; /* time entry was last used */
.
## diffname ip/ip.h 2003/0404
## diff -e /n/emeliedump/2003/0310/sys/src/9/ip/ip.h /n/emeliedump/2003/0404/sys/src/9/ip/ip.h
446a
char* e;
.
443d
|