| plan 9 kernel history: overview | file list | diff list |
1991/1012/port/ipdat.h (diff list | history)
| 1991/0705/sys/src/9/port/ipdat.h:12,19 – 1991/1012/sys/src/9/port/ipdat.h:12,22 (short | long | prev | next) | ||
|
Format edits. Add Ilhdr, IL constants, IL queue. Remove Ipconv.tcpctl.
rsc Fri Mar 4 12:44:25 2005 | ||
| 1991/0424 | typedef struct Tcpctl Tcpctl; typedef struct Tcphdr Tcphdr; typedef struct Timer Timer; | |
| 1991/1012 | typedef struct Ilhdr Ilhdr; typedef struct Ilcb Ilcb; | |
| 1991/0424 |
| |
| 1991/1012 | struct Etherhdr { | |
| 1991/0424 | #define ETHER_HDR 14 uchar d[6]; uchar s[6]; | |
| 1991/0705/sys/src/9/port/ipdat.h:37,43 – 1991/1012/sys/src/9/port/ipdat.h:40,47 | ||
| 1991/0424 | #define ET_IP 0x0800 /* A userlevel data gram */ | |
| 1991/1012 | struct Udphdr { | |
| 1991/0424 | #define UDP_EHSIZE 22 uchar d[6]; /* Ethernet destination */ uchar s[6]; /* Ethernet source */ | |
| 1991/0705/sys/src/9/port/ipdat.h:62,70 – 1991/1012/sys/src/9/port/ipdat.h:66,119 | ||
| 1991/0424 | uchar udpcksum[2]; /* Checksum */ }; | |
| 1991/1012 | struct Ilhdr { #define IL_EHSIZE 22 uchar d[6]; /* Ethernet destination */ uchar s[6]; /* Ethernet source */ uchar type[2]; /* Ethernet packet type */ uchar vihl; /* Version and header length */ uchar tos; /* Type of service */ uchar length[2]; /* packet length */ uchar id[2]; /* Identification */ uchar frag[2]; /* Fragment information */ #define IL_HDRSIZE 16 uchar ilsum[2]; /* Checksum including header */ uchar illen[2]; /* Packet length */ uchar iltype; /* Packet type */ uchar ilspec; /* Special */ uchar ilsrc[2]; /* Src port */ uchar ildst[2]; /* Dst port */ uchar ilid[4]; /* Sequence id */ uchar ilack[4]; /* Acked sequence */ }; struct Ilcb { int state; Block *unacked; Block *unackedtail; Block *outoforder; Block *outofordertail; ulong sent; ulong recvd; ulong lastack; }; enum { Ilsync, Ildata, Ildataquery, Ilack, Ilquerey, Ilstate, }; | |
| 1991/0424 | #define TCP_PKT (TCP_EHSIZE+TCP_IPLEN+TCP_PHDRSIZE) | |
| 1991/1012 | struct Tcphdr { | |
| 1991/0424 | #define TCP_EHSIZE 14 uchar d[6]; /* Ethernet destination */ uchar s[6]; /* Ethernet source */ | |
| 1991/0705/sys/src/9/port/ipdat.h:96,106 – 1991/1012/sys/src/9/port/ipdat.h:145,156 | ||
| 1991/0424 | /* Options segment */ uchar tcpopt[2]; uchar tcpmss[2]; | |
| 1991/1012 | }; | |
| 1991/0424 |
| |
| 1991/1012 | struct Timer { | |
| 1991/0424 | Timer *next; Timer *prev; int state; | |
| 1991/0705/sys/src/9/port/ipdat.h:108,116 – 1991/1012/sys/src/9/port/ipdat.h:158,167 | ||
| 1991/0424 | int count; void (*func)(void*); void *arg; | |
| 1991/1012 | }; | |
| 1991/0424 |
| |
| 1991/1012 | struct Tcpctl { | |
| 1991/0424 | QLock; uchar state; /* Connection state */ uchar type; /* Listening or active connection */ | |
| 1991/0705/sys/src/9/port/ipdat.h:166,172 – 1991/1012/sys/src/9/port/ipdat.h:217,224 | ||
| 1991/0424 | int mdev; /* Mean deviation of round trip */ }; | |
| 1991/1012 | struct Tcp { | |
| 1991/0424 | Port source; Port dest; int seq; | |
| 1991/0705/sys/src/9/port/ipdat.h:175,192 – 1991/1012/sys/src/9/port/ipdat.h:227,246 | ||
| 1991/0424 | ushort wnd; ushort up; ushort mss; | |
| 1991/1012 | }; | |
| 1991/0424 |
| |
| 1991/1012 | struct Reseq { | |
| 1991/0424 | Reseq *next; Tcp seg; Block *bp; ushort length; char tos; | |
| 1991/1012 | }; | |
| 1991/0424 | /* An ip interface used for UDP/TCP/ARP/ICMP */ | |
| 1991/1012 | struct Ipconv { | |
| 1991/0424 | QLock; /* Ref count lock */ int ref; Qinfo *stproto; /* Stream protocol for this device */ | |
| 1991/0705/sys/src/9/port/ipdat.h:207,213 – 1991/1012/sys/src/9/port/ipdat.h:261,270 | ||
| 1991/0424 | int backlog; /* Maximum number of waiting connections */ int curlog; /* Number of waiting connections */ int contype; | |
| 1991/1012 | union { Tcpctl tcpctl; /* Tcp control block */ Ilcb ilctl; /* Il control block */ }; | |
| 1991/0424 | }; #define MAX_TIME 100000000 /* Forever */ | |
| 1991/0705/sys/src/9/port/ipdat.h:255,261 – 1991/1012/sys/src/9/port/ipdat.h:312,319 | ||
| 1991/0424 | #define read_timer(t) ((t)->count) #define run_timer(t) ((t)->state == TIMER_RUN) | |
| 1991/1012 | enum { | |
| 1991/0424 | CLOSED = 0, LISTEN, SYN_SENT, | |
| 1991/0705/sys/src/9/port/ipdat.h:267,278 – 1991/1012/sys/src/9/port/ipdat.h:325,337 | ||
| 1991/0424 | CLOSING, LAST_ACK, TIME_WAIT | |
| 1991/1012 | }; | |
| 1991/0424 | /* * Ip interface structure. We have one for each active protocol driver */ | |
| 1991/1012 | struct Ipifc { | |
| 1991/0424 | QLock; int ref; uchar protocol; /* Ip header protocol number */ | |
| 1991/0705/sys/src/9/port/ipdat.h:285,291 – 1991/1012/sys/src/9/port/ipdat.h:344,351 | ||
| 1991/0424 | Lock; }; | |
| 1991/1012 | struct Fragq { | |
| 1991/0424 | QLock; Block *blist; Fragq *next; | |
| 1991/0705/sys/src/9/port/ipdat.h:292,305 – 1991/1012/sys/src/9/port/ipdat.h:352,367 | ||
| 1991/0424 | Ipaddr src; Ipaddr dst; ushort id; | |
| 1991/1012 | }; | |
| 1991/0424 |
| |
| 1991/1012 | struct Ipfrag { | |
| 1991/0424 | ushort foff; ushort flen; | |
| 1991/1012 | }; | |
| 1991/0424 |
| |
| 1991/1012 | struct Arpcache { | |
| 1991/0424 | uchar status; /* Entry status */ uchar type; /* Entry type */ Ipaddr ip; /* Host byte order */ | |
| 1991/0705/sys/src/9/port/ipdat.h:311,316 – 1991/1012/sys/src/9/port/ipdat.h:373,379 | ||
| 1991/0424 | Arpcache *frwd; Arpcache *prev; }; | |
| 1991/1012 | ||
| 1991/0424 | #define ARP_FREE 0 #define ARP_OK 1 #define ARP_ASKED 2 | |
| 1991/0705/sys/src/9/port/ipdat.h:341,350 – 1991/1012/sys/src/9/port/ipdat.h:404,415 | ||
| 1991/0424 | #define IP_MAX 8192 /* Maximum Internet packet size */ #define UDP_MAX (IP_MAX-ETHER_IPHDR) /* Maximum UDP datagram size */ #define UDP_DATMAX (UDP_MAX-UDP_HDRSIZE) /* Maximum amount of udp data */ | |
| 1991/1012 | #define IL_DATMAX (IP_MAX-IL_HDRSIZE) /* Maximum IL data in one ip packet */ | |
| 1991/0424 | /* Protocol numbers */ #define IP_UDPPROTO 17 #define IP_TCPPROTO 6 | |
| 1991/1012 | #define IP_ILPROTO 190 /* I have no idea */ | |
| 1991/0424 | /* Protocol port numbers */ #define PORTALLOC 5000 /* First automatic allocated port */ | |
| 1991/0705/sys/src/9/port/ipdat.h:440,442 – 1991/1012/sys/src/9/port/ipdat.h:505,508 | ||
| 1991/0424 | extern Qinfo tcpinfo; extern Qinfo ipinfo; extern Qinfo udpinfo; | |
| 1991/1012 | extern Qinfo ilinfo; | |