00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _SLIRP_SOCKET_H_
00011 #define _SLIRP_SOCKET_H_
00012
00013 #define SO_EXPIRE 240000
00014 #define SO_EXPIREFAST 10000
00015
00016
00017
00018
00019
00020 struct socket {
00021 struct socket *so_next,*so_prev;
00022
00023 int s;
00024
00025
00026 struct mbuf *so_m;
00027
00028
00029 struct tcpiphdr *so_ti;
00030
00031 int so_urgc;
00032 struct in_addr so_faddr;
00033 struct in_addr so_laddr;
00034 u_int16_t so_fport;
00035 u_int16_t so_lport;
00036
00037 u_int8_t so_iptos;
00038 u_int8_t so_emu;
00039
00040 u_char so_type;
00041 int so_state;
00042
00043 struct tcpcb *so_tcpcb;
00044 u_int so_expire;
00045
00046 int so_queued;
00047 int so_nqueued;
00048
00049
00050
00051 struct sbuf so_rcv;
00052 struct sbuf so_snd;
00053 void * extra;
00054 };
00055
00056
00057
00058
00059
00060
00061 #define SS_NOFDREF 0x001
00062
00063 #define SS_ISFCONNECTING 0x002
00064 #define SS_ISFCONNECTED 0x004
00065 #define SS_FCANTRCVMORE 0x008
00066 #define SS_FCANTSENDMORE 0x010
00067
00068 #define SS_FWDRAIN 0x040
00069
00070 #define SS_CTL 0x080
00071 #define SS_FACCEPTCONN 0x100
00072 #define SS_FACCEPTONCE 0x200
00073
00074 extern struct socket tcb;
00075
00076 struct socket * solookup _P((struct socket *, struct in_addr, u_int, struct in_addr, u_int));
00077 struct socket * socreate _P((void));
00078 void sofree _P((struct socket *));
00079 int soread _P((struct socket *));
00080 void sorecvoob _P((struct socket *));
00081 int sosendoob _P((struct socket *));
00082 int sowrite _P((struct socket *));
00083 void sorecvfrom _P((struct socket *));
00084 int sosendto _P((struct socket *, struct mbuf *));
00085 struct socket * solisten _P((u_int, u_int32_t, u_int, int));
00086 void soisfconnecting _P((register struct socket *));
00087 void soisfconnected _P((register struct socket *));
00088 void soisfdisconnected _P((struct socket *));
00089 void sofwdrain _P((struct socket *));
00090 size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np);
00091 int soreadbuf(struct socket *so, const char *buf, int size);
00092
00093 #endif