socket.h revision 1ca4a6ab3f30cc1d00058a1a23e62bb267016ea1
0N/A/*
1834N/A * Copyright (c) 1995 Danny Gasparovski.
0N/A *
0N/A * Please read the file COPYRIGHT for the
0N/A * terms and conditions of the copyright.
0N/A */
0N/A
0N/A/* MINE */
0N/A
0N/A#ifndef _SLIRP_SOCKET_H_
0N/A#define _SLIRP_SOCKET_H_
0N/A
0N/A#define SO_EXPIRE 240000
0N/A#define SO_EXPIREFAST 10000
0N/A
0N/A/*
0N/A * Our socket structure
0N/A */
1472N/A
1472N/Astruct socket {
1472N/A struct socket *so_next,*so_prev; /* For a linked list of sockets */
0N/A
0N/A int s; /* The actual socket */
0N/A
1879N/A /* XXX union these with not-yet-used sbuf params */
1879N/A struct mbuf *so_m; /* Pointer to the original SYN packet,
1879N/A * for non-blocking connect()'s, and
1879N/A * PING reply's */
1879N/A struct tcpiphdr *so_ti; /* Pointer to the original ti within
1879N/A * so_mconn, for non-blocking connections */
1879N/A int so_urgc;
1879N/A struct in_addr so_faddr; /* foreign host table entry */
1879N/A struct in_addr so_laddr; /* local host table entry */
1879N/A u_int16_t so_fport; /* foreign port */
1879N/A u_int16_t so_lport; /* local port */
0N/A
0N/A u_int8_t so_iptos; /* Type of service */
0N/A u_int8_t so_emu; /* Is the socket emulated? */
0N/A
0N/A u_char so_type; /* Type of socket, UDP or TCP */
0N/A int so_state; /* internal state flags SS_*, below */
145N/A
145N/A struct tcpcb *so_tcpcb; /* pointer to TCP protocol control block */
145N/A u_int so_expire; /* When the socket will expire */
145N/A
145N/A int so_queued; /* Number of packets queued from this socket */
605N/A int so_nqueued; /* Number of packets queued in a row
145N/A * Used to determine when to "downgrade" a session
145N/A * from fastq to batchq */
145N/A
145N/A struct sbuf so_rcv; /* Receive buffer */
145N/A struct sbuf so_snd; /* Send buffer */
145N/A void * extra; /* Extra pointer */
145N/A};
145N/A
145N/A
145N/A/*
145N/A * Socket state bits. (peer means the host on the Internet,
145N/A * local host means the host on the other end of the modem)
145N/A */
145N/A#define SS_NOFDREF 0x001 /* No fd reference */
145N/A
145N/A#define SS_ISFCONNECTING 0x002 /* Socket is connecting to peer (non-blocking connect()'s) */
145N/A#define SS_ISFCONNECTED 0x004 /* Socket is connected to peer */
145N/A#define SS_FCANTRCVMORE 0x008 /* Socket can't receive more from peer (for half-closes) */
145N/A#define SS_FCANTSENDMORE 0x010 /* Socket can't send more to peer (for half-closes) */
145N/A/* #define SS_ISFDISCONNECTED 0x020*/ /* Socket has disconnected from peer, in 2MSL state */
145N/A#define SS_FWDRAIN 0x040 /* We received a FIN, drain data and set SS_FCANTSENDMORE */
145N/A
145N/A/* #define SS_CTL 0x080 */
145N/A#define SS_FACCEPTCONN 0x100 /* Socket is accepting connections from a host on the internet */
145N/A#define SS_FACCEPTONCE 0x200 /* If set, the SS_FACCEPTCONN socket will die after one accept */
145N/A
145N/Aextern struct socket tcb;
145N/A
145N/A
145N/A#if defined(DECLARE_IOVEC) && !defined(HAVE_READV)
145N/Astruct iovec {
145N/A char *iov_base;
145N/A size_t iov_len;
145N/A};
145N/A#endif
145N/A
145N/Avoid so_init _P((void));
145N/Astruct socket * solookup _P((struct socket *, struct in_addr, u_int, struct in_addr, u_int));
145N/Astruct socket * socreate _P((void));
145N/Avoid sofree _P((PNATState, struct socket *));
145N/Aint soread _P((PNATState, struct socket *));
145N/Avoid sorecvoob _P((PNATState, struct socket *));
145N/Aint sosendoob _P((struct socket *));
0N/Aint sowrite _P((PNATState, struct socket *));
0N/Avoid sorecvfrom _P((PNATState, struct socket *));
145N/Aint sosendto _P((PNATState, struct socket *, struct mbuf *));
145N/Astruct socket * solisten _P((PNATState, u_int, u_int32_t, u_int, int));
0N/Avoid sorwakeup _P((struct socket *));
145N/Avoid sowwakeup _P((struct socket *));
145N/Avoid soisfconnecting _P((register struct socket *));
145N/Avoid soisfconnected _P((register struct socket *));
0N/Avoid sofcantrcvmore _P((struct socket *));
0N/Avoid sofcantsendmore _P((struct socket *));
145N/Avoid soisfdisconnected _P((struct socket *));
0N/Avoid sofwdrain _P((struct socket *));
0N/A
145N/A#endif /* _SOCKET_H_ */
145N/A