socketvar.h (14505) | socketvar.h (14547) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)socketvar.h 8.3 (Berkeley) 2/19/95 | 1/*- 2 * Copyright (c) 1982, 1986, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)socketvar.h 8.3 (Berkeley) 2/19/95 |
34 * $Id: socketvar.h,v 1.16 1996/02/29 00:07:13 hsu Exp $ | 34 * $Id: socketvar.h,v 1.12 1996/03/11 02:22:23 hsu Exp $ |
35 */ 36 37#ifndef _SYS_SOCKETVAR_H_ 38#define _SYS_SOCKETVAR_H_ 39 40#include <sys/stat.h> /* for struct stat */ 41#include <sys/filedesc.h> /* for struct filedesc */ 42#include <sys/select.h> /* for struct selinfo */ --- 18 unchanged lines hidden (view full) --- 61 * For head socket so_q0 queues partially completed connections, 62 * while so_q is a queue of connections ready to be accepted. 63 * If a connection is aborted and it has so_head set, then 64 * it has to be pulled out of either so_q0 or so_q. 65 * We allow connections to queue up based on current queue lengths 66 * and limit on number of queued connections for this socket. 67 */ 68 struct socket *so_head; /* back pointer to accept socket */ | 35 */ 36 37#ifndef _SYS_SOCKETVAR_H_ 38#define _SYS_SOCKETVAR_H_ 39 40#include <sys/stat.h> /* for struct stat */ 41#include <sys/filedesc.h> /* for struct filedesc */ 42#include <sys/select.h> /* for struct selinfo */ --- 18 unchanged lines hidden (view full) --- 61 * For head socket so_q0 queues partially completed connections, 62 * while so_q is a queue of connections ready to be accepted. 63 * If a connection is aborted and it has so_head set, then 64 * it has to be pulled out of either so_q0 or so_q. 65 * We allow connections to queue up based on current queue lengths 66 * and limit on number of queued connections for this socket. 67 */ 68 struct socket *so_head; /* back pointer to accept socket */ |
69 struct socket *so_q0; /* queue of partial connections */ 70 struct socket *so_q; /* queue of incoming connections */ 71 short so_q0len; /* partials on so_q0 */ 72 short so_qlen; /* number of connections on so_q */ | 69 TAILQ_HEAD(, socket) so_incomp; /* queue of partial unaccepted connections */ 70 TAILQ_HEAD(, socket) so_comp; /* queue of complete unaccepted connections */ 71 TAILQ_ENTRY(socket) so_list; /* list of unaccepted connections */ 72 short so_qlen; /* number of unaccepted connections */ |
73 short so_qlimit; /* max number queued connections */ 74 short so_timeo; /* connection timeout */ 75 u_short so_error; /* error affecting connection */ 76 pid_t so_pgid; /* pgid for signals */ 77 u_long so_oobmark; /* chars to oob mark */ 78/* 79 * Variables for socket buffering. 80 */ --- 20 unchanged lines hidden (view full) --- 101 caddr_t so_tpcb; /* Wisc. protocol control block XXX */ 102 void (*so_upcall) __P((struct socket *so, caddr_t arg, int waitf)); 103 caddr_t so_upcallarg; /* Arg for above */ 104}; 105 106/* 107 * Socket state bits. 108 */ | 73 short so_qlimit; /* max number queued connections */ 74 short so_timeo; /* connection timeout */ 75 u_short so_error; /* error affecting connection */ 76 pid_t so_pgid; /* pgid for signals */ 77 u_long so_oobmark; /* chars to oob mark */ 78/* 79 * Variables for socket buffering. 80 */ --- 20 unchanged lines hidden (view full) --- 101 caddr_t so_tpcb; /* Wisc. protocol control block XXX */ 102 void (*so_upcall) __P((struct socket *so, caddr_t arg, int waitf)); 103 caddr_t so_upcallarg; /* Arg for above */ 104}; 105 106/* 107 * Socket state bits. 108 */ |
109#define SS_NOFDREF 0x001 /* no file table ref any more */ 110#define SS_ISCONNECTED 0x002 /* socket connected to a peer */ 111#define SS_ISCONNECTING 0x004 /* in process of connecting to peer */ 112#define SS_ISDISCONNECTING 0x008 /* in process of disconnecting */ 113#define SS_CANTSENDMORE 0x010 /* can't send more data to peer */ 114#define SS_CANTRCVMORE 0x020 /* can't receive more data from peer */ 115#define SS_RCVATMARK 0x040 /* at mark on input */ | 109#define SS_NOFDREF 0x0001 /* no file table ref any more */ 110#define SS_ISCONNECTED 0x0002 /* socket connected to a peer */ 111#define SS_ISCONNECTING 0x0004 /* in process of connecting to peer */ 112#define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */ 113#define SS_CANTSENDMORE 0x0010 /* can't send more data to peer */ 114#define SS_CANTRCVMORE 0x0020 /* can't receive more data from peer */ 115#define SS_RCVATMARK 0x0040 /* at mark on input */ |
116 | 116 |
117#define SS_PRIV 0x080 /* privileged for broadcast, raw... */ 118#define SS_NBIO 0x100 /* non-blocking ops */ 119#define SS_ASYNC 0x200 /* async i/o notify */ 120#define SS_ISCONFIRMING 0x400 /* deciding to accept connection req */ | 117#define SS_PRIV 0x0080 /* privileged for broadcast, raw... */ 118#define SS_NBIO 0x0100 /* non-blocking ops */ 119#define SS_ASYNC 0x0200 /* async i/o notify */ 120#define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */ |
121 | 121 |
122#define SS_INCOMP 0x0800 /* unaccepted, incomplete connection */ 123#define SS_COMP 0x1000 /* unaccepted, complete connection */ |
|
122 | 124 |
125 |
|
123/* 124 * Macros for sockets and socket buffering. 125 */ 126 127/* 128 * How much space is there in a socket buffer (so->so_snd or so->so_rcv)? 129 * This is problematical if the fields are unsigned, as the space might 130 * still be negative (cc > hiwat or mbcnt > mbmax). Should detect --- 6 unchanged lines hidden (view full) --- 137/* do we have to send all at once on a socket? */ 138#define sosendallatonce(so) \ 139 ((so)->so_proto->pr_flags & PR_ATOMIC) 140 141/* can we read something from so? */ 142#define soreadable(so) \ 143 ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \ 144 ((so)->so_state & SS_CANTRCVMORE) || \ | 126/* 127 * Macros for sockets and socket buffering. 128 */ 129 130/* 131 * How much space is there in a socket buffer (so->so_snd or so->so_rcv)? 132 * This is problematical if the fields are unsigned, as the space might 133 * still be negative (cc > hiwat or mbcnt > mbmax). Should detect --- 6 unchanged lines hidden (view full) --- 140/* do we have to send all at once on a socket? */ 141#define sosendallatonce(so) \ 142 ((so)->so_proto->pr_flags & PR_ATOMIC) 143 144/* can we read something from so? */ 145#define soreadable(so) \ 146 ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \ 147 ((so)->so_state & SS_CANTRCVMORE) || \ |
145 (so)->so_qlen || (so)->so_error) | 148 (so)->so_comp.tqh_first || (so)->so_error) |
146 147/* can we write something to so? */ 148#define sowriteable(so) \ 149 ((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \ 150 (((so)->so_state&SS_ISCONNECTED) || \ 151 ((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \ 152 ((so)->so_state & SS_CANTSENDMORE) || \ 153 (so)->so_error) --- 94 unchanged lines hidden (view full) --- 248void sohasoutofband __P((struct socket *so)); 249void soisconnected __P((struct socket *so)); 250void soisconnecting __P((struct socket *so)); 251void soisdisconnected __P((struct socket *so)); 252void soisdisconnecting __P((struct socket *so)); 253int solisten __P((struct socket *so, int backlog)); 254struct socket * 255 sonewconn1 __P((struct socket *head, int connstatus)); | 149 150/* can we write something to so? */ 151#define sowriteable(so) \ 152 ((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \ 153 (((so)->so_state&SS_ISCONNECTED) || \ 154 ((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \ 155 ((so)->so_state & SS_CANTSENDMORE) || \ 156 (so)->so_error) --- 94 unchanged lines hidden (view full) --- 251void sohasoutofband __P((struct socket *so)); 252void soisconnected __P((struct socket *so)); 253void soisconnecting __P((struct socket *so)); 254void soisdisconnected __P((struct socket *so)); 255void soisdisconnecting __P((struct socket *so)); 256int solisten __P((struct socket *so, int backlog)); 257struct socket * 258 sonewconn1 __P((struct socket *head, int connstatus)); |
256void soqinsque __P((struct socket *head, struct socket *so, int q)); 257int soqremque __P((struct socket *so, int q)); | |
258int soreceive __P((struct socket *so, struct mbuf **paddr, struct uio *uio, 259 struct mbuf **mp0, struct mbuf **controlp, int *flagsp)); 260int soreserve __P((struct socket *so, u_long sndcc, u_long rcvcc)); 261void sorflush __P((struct socket *so)); 262int sosend __P((struct socket *so, struct mbuf *addr, struct uio *uio, 263 struct mbuf *top, struct mbuf *control, int flags)); 264int sosetopt __P((struct socket *so, int level, int optname, 265 struct mbuf *m0)); 266int soshutdown __P((struct socket *so, int how)); 267void sowakeup __P((struct socket *so, struct sockbuf *sb)); 268#endif /* KERNEL */ 269 270#endif /* !_SYS_SOCKETVAR_H_ */ | 259int soreceive __P((struct socket *so, struct mbuf **paddr, struct uio *uio, 260 struct mbuf **mp0, struct mbuf **controlp, int *flagsp)); 261int soreserve __P((struct socket *so, u_long sndcc, u_long rcvcc)); 262void sorflush __P((struct socket *so)); 263int sosend __P((struct socket *so, struct mbuf *addr, struct uio *uio, 264 struct mbuf *top, struct mbuf *control, int flags)); 265int sosetopt __P((struct socket *so, int level, int optname, 266 struct mbuf *m0)); 267int soshutdown __P((struct socket *so, int how)); 268void sowakeup __P((struct socket *so, struct sockbuf *sb)); 269#endif /* KERNEL */ 270 271#endif /* !_SYS_SOCKETVAR_H_ */ |