2002-10-29 23:12:42 +03:00
|
|
|
#ifndef _NET_SOCKET_H
|
|
|
|
#define _NET_SOCKET_H
|
|
|
|
|
|
|
|
#include <sys/socketvar.h>
|
2002-10-30 04:21:54 +03:00
|
|
|
#include <mbuf.h>
|
2002-10-29 23:12:42 +03:00
|
|
|
|
|
|
|
/* Function prototypes */
|
|
|
|
|
2002-10-30 19:40:51 +03:00
|
|
|
/* These functions are exported through the core module */
|
|
|
|
|
|
|
|
int socket_init (struct socket **nso);
|
|
|
|
int socket_create (struct socket *so, int dom, int type, int proto);
|
|
|
|
int socket_shutdown (struct socket *so, int how); // XXX this one is not used at all
|
|
|
|
int socket_close (struct socket *so);
|
2002-10-29 23:12:42 +03:00
|
|
|
|
2002-10-30 19:40:51 +03:00
|
|
|
int socket_bind (struct socket *so, char *, int);
|
|
|
|
int socket_listen (struct socket *so, int backlog);
|
|
|
|
int socket_connect (struct socket *so, char *, int);
|
|
|
|
int socket_accept (struct socket *so, struct socket **nso, void *, int *);
|
2002-10-29 23:12:42 +03:00
|
|
|
|
2002-10-30 19:40:51 +03:00
|
|
|
int socket_writev (struct socket *so, struct iovec *, int flags);
|
|
|
|
int socket_readv (struct socket *so, struct iovec *, int *flags);
|
|
|
|
int socket_send (struct socket *so, struct msghdr *, int flags, int *retsize);
|
|
|
|
int socket_recv (struct socket *so, struct msghdr *, caddr_t namelenp, int *retsize);
|
2002-10-29 23:12:42 +03:00
|
|
|
|
2002-10-30 19:40:51 +03:00
|
|
|
int socket_setsockopt (struct socket *so, int, int, const void *, size_t);
|
|
|
|
int socket_getsockopt (struct socket *so, int, int, void *, size_t *);
|
|
|
|
int socket_ioctl (struct socket *so, int cmd, caddr_t data);
|
2002-10-29 23:12:42 +03:00
|
|
|
|
2002-10-30 19:40:51 +03:00
|
|
|
int socket_getpeername (struct socket *so, struct sockaddr *, int *);
|
|
|
|
int socket_getsockname (struct socket *so, struct sockaddr *, int *);
|
2002-10-29 23:12:42 +03:00
|
|
|
|
2005-10-01 02:32:01 +04:00
|
|
|
int socket_socketpair (struct socket *so, struct socket **nso);
|
2005-09-28 16:21:42 +04:00
|
|
|
|
2002-10-30 19:40:51 +03:00
|
|
|
int socket_set_event_callback(struct socket *so, socket_event_callback, void *, int);
|
2002-10-29 23:12:42 +03:00
|
|
|
|
|
|
|
|
|
|
|
/* these are all private to the stack...although may be shared with
|
|
|
|
* other network modules.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
struct socket *sonewconn(struct socket *head, int connstatus);
|
|
|
|
int soreserve (struct socket *so, uint32 sndcc, uint32 rcvcc);
|
|
|
|
|
2002-10-30 23:59:25 +03:00
|
|
|
void sockbuf_release(struct sockbuf *sb);
|
|
|
|
int sockbuf_reserve(struct sockbuf *sb, uint32 cc);
|
|
|
|
void sockbuf_drop(struct sockbuf *sb, int len);
|
|
|
|
void sockbuf_droprecord(struct sockbuf *sb);
|
|
|
|
void sockbuf_flush(struct sockbuf *sb);
|
|
|
|
int sockbuf_wait(struct sockbuf *sb);
|
|
|
|
void sockbuf_append(struct sockbuf *sb, struct mbuf *m);
|
|
|
|
int sockbuf_appendaddr(struct sockbuf *sb, struct sockaddr *asa,
|
2002-10-29 23:12:42 +03:00
|
|
|
struct mbuf *m0, struct mbuf *control);
|
2002-10-30 23:59:25 +03:00
|
|
|
int sockbuf_appendcontrol(struct sockbuf *sb, struct mbuf *m0,
|
2002-10-29 23:12:42 +03:00
|
|
|
struct mbuf *control);
|
2002-10-30 23:59:25 +03:00
|
|
|
void sockbuf_appendrecord(struct sockbuf *sb, struct mbuf *m0);
|
|
|
|
void sockbuf_compress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n);
|
|
|
|
void sockbuf_insertoob(struct sockbuf *, struct mbuf *);
|
2002-10-29 23:12:42 +03:00
|
|
|
|
|
|
|
void sowakeup(struct socket *so, struct sockbuf *sb);
|
|
|
|
|
|
|
|
int sodisconnect(struct socket *);
|
2002-10-30 23:59:25 +03:00
|
|
|
|
|
|
|
void socket_set_hasoutofband(struct socket *so);
|
|
|
|
void socket_set_cantsendmore(struct socket *so);
|
|
|
|
void socket_set_cantrcvmore(struct socket *so);
|
|
|
|
void socket_set_connected(struct socket *so);
|
|
|
|
void socket_set_connecting(struct socket *so);
|
|
|
|
void socket_set_disconnected(struct socket *so);
|
|
|
|
void socket_set_disconnecting(struct socket *so);
|
|
|
|
|
2002-10-29 23:12:42 +03:00
|
|
|
int sorflush(struct socket *so);
|
|
|
|
|
2002-10-30 23:59:25 +03:00
|
|
|
int sockbuf_lock(struct sockbuf *sb);
|
2002-10-29 23:12:42 +03:00
|
|
|
int nsleep(sem_id chan, char *msg, int timeo);
|
|
|
|
void wakeup(sem_id chan);
|
|
|
|
|
|
|
|
#endif
|