socket.h revision 571c90a734400801da973f986190fac9fc5efd0d
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync * Copyright (c) 1995 Danny Gasparovski.
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync * Please read the file COPYRIGHT for the
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync * terms and conditions of the copyright.
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync * Our socket structure
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync struct socket *so_prev; /* For a linked list of sockets */
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync int s; /* The actual socket */
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync /* XXX union these with not-yet-used sbuf params */
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync struct mbuf *so_m; /* Pointer to the original SYN packet,
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync * for non-blocking connect()'s, and
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync * PING reply's */
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync struct tcpiphdr *so_ti; /* Pointer to the original ti within
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync * so_mconn, for non-blocking connections */
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync struct in_addr so_faddr; /* foreign host table entry */
17ef1920962b3df57bf6d2704ced1586396d96f0vboxsync struct in_addr so_laddr; /* local host table entry */
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync int so_state; /* internal state flags SS_*, below */
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync struct tcpcb *so_tcpcb; /* pointer to TCP protocol control block */
8867771015571c5542d39e393d7fe6304421a928vboxsync int so_queued; /* Number of packets queued from this socket */
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync int so_nqueued; /* Number of packets queued in a row
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync * Used to determine when to "downgrade" a session
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync * from fastq to batchq */
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync#else /* !RT_OS_WINDOWS */
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync * FD_CLOSE event has been occurred on socket
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync#endif /* RT_OS_WINDOWS */
8867771015571c5542d39e393d7fe6304421a928vboxsync void (* so_timeout)(PNATState pData, struct socket *so, void *arg);
8867771015571c5542d39e393d7fe6304421a928vboxsync /* storage of source ether address */
8867771015571c5542d39e393d7fe6304421a928vboxsync /* required for port-forwarding */
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync /* Assert(strcmp(RTThreadSelfName(), "EMT") != 0); */ \
9de47c4ec7b0fc9a384e4b815153de399da7b8devboxsync Log2(("lock:%s:%d L on %R[natsock]\n", __FUNCTION__, __LINE__, (so))); \
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync } while (0)
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync if ((so) != NULL) Log2(("lock:%s:%d U on %R[natsock]\n", __FUNCTION__, __LINE__, (so))); \
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync } while (0)
4c464a0800535c29782d7ab5bcd7820bc7115cd7vboxsync } while (0)
8867771015571c5542d39e393d7fe6304421a928vboxsync } while (0)
9de47c4ec7b0fc9a384e4b815153de399da7b8devboxsync * Socket state bits. (peer means the host on the Internet,
9de47c4ec7b0fc9a384e4b815153de399da7b8devboxsync * local host means the host on the other end of the modem)
8867771015571c5542d39e393d7fe6304421a928vboxsync#define SS_ISFCONNECTING 0x002 /* Socket is connecting to peer (non-blocking connect()'s) */
8867771015571c5542d39e393d7fe6304421a928vboxsync#define SS_ISFCONNECTED 0x004 /* Socket is connected to peer */
9de47c4ec7b0fc9a384e4b815153de399da7b8devboxsync#define SS_FCANTRCVMORE 0x008 /* Socket can't receive more from peer (for half-closes) */
9de47c4ec7b0fc9a384e4b815153de399da7b8devboxsync#define SS_FCANTSENDMORE 0x010 /* Socket can't send more to peer (for half-closes) */
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync/* #define SS_ISFDISCONNECTED 0x020*/ /* Socket has disconnected from peer, in 2MSL state */
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync#define SS_FWDRAIN 0x040 /* We received a FIN, drain data and set SS_FCANTSENDMORE */
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync/* #define SS_CTL 0x080 */
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync#define SS_FACCEPTCONN 0x100 /* Socket is accepting connections from a host on the internet */
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsync#define SS_FACCEPTONCE 0x200 /* If set, the SS_FACCEPTCONN socket will die after one accept */
8867771015571c5542d39e393d7fe6304421a928vboxsyncstruct socket * solookup (struct socket *, struct in_addr, u_int, struct in_addr, u_int);
9de47c4ec7b0fc9a384e4b815153de399da7b8devboxsyncvoid soread_queue (PNATState, struct socket *, int *);
9de47c4ec7b0fc9a384e4b815153de399da7b8devboxsyncint sosendto (PNATState, struct socket *, struct mbuf *);
fe14fe6d46ce87a9b25cbdacb3a20b1f87bf34c7vboxsyncstruct socket * solisten (PNATState, u_int, u_int32_t, u_int, int);
4c464a0800535c29782d7ab5bcd7820bc7115cd7vboxsync#endif /* _SOCKET_H_ */