root/include/linux/socket.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef _LINUX_SOCKET_H
   2 #define _LINUX_SOCKET_H
   3 
   4 #include <asm/socket.h>                 /* arch-dependent defines       */
   5 #include <linux/sockios.h>              /* the SIOCxxx I/O controls     */
   6 #include <linux/uio.h>                  /* iovec support                */
   7 
   8 struct sockaddr 
   9 {
  10         unsigned short  sa_family;      /* address family, AF_xxx       */
  11         char            sa_data[14];    /* 14 bytes of protocol address */
  12 };
  13 
  14 struct linger {
  15         int             l_onoff;        /* Linger active                */
  16         int             l_linger;       /* How long to linger for       */
  17 };
  18 
  19 struct msghdr 
  20 {
  21         void    *       msg_name;       /* Socket name                  */
  22         int             msg_namelen;    /* Length of name               */
  23         struct iovec *  msg_iov;        /* Data blocks                  */
  24         int             msg_iovlen;     /* Number of blocks             */
  25         void    *       msg_accrights;  /* Per protocol magic (eg BSD file descriptor passing) */
  26         int             msg_accrightslen;       /* Length of rights list */
  27 };
  28 
  29 /*
  30  *      4.4BSD changed to these new names for no apparent reason.
  31  */
  32  
  33 #define msg_control     msg_accrights   
  34 #define msg_controllen  msg_accrightslen
  35 
  36 /* Control Messages */
  37 
  38 #define SCM_RIGHTS              1
  39 
  40 /* Socket types. */
  41 #define SOCK_STREAM     1               /* stream (connection) socket   */
  42 #define SOCK_DGRAM      2               /* datagram (conn.less) socket  */
  43 #define SOCK_RAW        3               /* raw socket                   */
  44 #define SOCK_RDM        4               /* reliably-delivered message   */
  45 #define SOCK_SEQPACKET  5               /* sequential packet socket     */
  46 #define SOCK_PACKET     10              /* linux specific way of        */
  47                                         /* getting packets at the dev   */
  48                                         /* level.  For writing rarp and */
  49                                         /* other similar things on the  */
  50                                         /* user level.                  */
  51 
  52 /* Supported address families. */
  53 #define AF_UNSPEC       0
  54 #define AF_UNIX         1       /* Unix domain sockets          */
  55 #define AF_INET         2       /* Internet IP Protocol         */
  56 #define AF_AX25         3       /* Amateur Radio AX.25          */
  57 #define AF_IPX          4       /* Novell IPX                   */
  58 #define AF_APPLETALK    5       /* Appletalk DDP                */
  59 #define AF_NETROM       6       /* Amateur radio NetROM         */
  60 #define AF_BRIDGE       7       /* Multiprotocol bridge         */
  61 #define AF_AAL5         8       /* Reserved for Werner's ATM    */
  62 #define AF_X25          9       /* Reserved for X.25 project    */
  63 #define AF_INET6        10      /* IP version 6                 */
  64 #define AF_MAX          12      /* For now.. */
  65 
  66 /* Protocol families, same as address families. */
  67 #define PF_UNSPEC       AF_UNSPEC
  68 #define PF_UNIX         AF_UNIX
  69 #define PF_INET         AF_INET
  70 #define PF_AX25         AF_AX25
  71 #define PF_IPX          AF_IPX
  72 #define PF_APPLETALK    AF_APPLETALK
  73 #define PF_NETROM       AF_NETROM
  74 #define PF_BRIDGE       AF_BRIDGE
  75 #define PF_AAL5         AF_AAL5
  76 #define PF_X25          AF_X25
  77 #define PF_INET6        AF_INET6
  78 
  79 #define PF_MAX          AF_MAX
  80 
  81 /* Maximum queue length specificable by listen.  */
  82 #define SOMAXCONN       128
  83 
  84 /* Flags we can use with send/ and recv. */
  85 #define MSG_OOB         1
  86 #define MSG_PEEK        2
  87 #define MSG_DONTROUTE   4
  88 /*#define MSG_CTRUNC    8       - We need to support this for BSD oddments */
  89 
  90 /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
  91 #define SOL_IP          0
  92 #define SOL_IPX         256
  93 #define SOL_AX25        257
  94 #define SOL_ATALK       258
  95 #define SOL_NETROM      259
  96 #define SOL_TCP         6
  97 #define SOL_UDP         17
  98 
  99 #ifdef __KERNEL__
 100 
 101 /* IP options */
 102 #define IP_TOS          1
 103 #define IPTOS_LOWDELAY          0x10
 104 #define IPTOS_THROUGHPUT        0x08
 105 #define IPTOS_RELIABILITY       0x04
 106 #define IP_TTL          2
 107 #define IP_HDRINCL      3
 108 #define IP_OPTIONS      4
 109 
 110 #define IP_MULTICAST_IF                 32
 111 #define IP_MULTICAST_TTL                33
 112 #define IP_MULTICAST_LOOP               34
 113 #define IP_ADD_MEMBERSHIP               35
 114 #define IP_DROP_MEMBERSHIP              36
 115 
 116 #endif /* __KERNEL__ */
 117 
 118 /* These need to appear somewhere around here */
 119 #define IP_DEFAULT_MULTICAST_TTL        1
 120 #define IP_DEFAULT_MULTICAST_LOOP       1
 121 #define IP_MAX_MEMBERSHIPS              20
 122  
 123 /* IPX options */
 124 #define IPX_TYPE        1
 125 
 126 /* TCP options - this way around because someone left a set in the c library includes */
 127 #define TCP_NODELAY     1
 128 #define TCP_MAXSEG      2
 129 
 130 /* The various priorities. */
 131 #define SOPRI_INTERACTIVE       0
 132 #define SOPRI_NORMAL            1
 133 #define SOPRI_BACKGROUND        2
 134 
 135 #ifdef __KERNEL__
 136 extern void memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
 137 extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode);
 138 extern void memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
 139 extern int move_addr_to_user(void *kaddr, int klen, void *uaddr, int *ulen);
 140 extern int move_addr_to_kernel(void *uaddr, int ulen, void *kaddr);
 141 #endif
 142 #endif /* _LINUX_SOCKET_H */

/* [previous][next][first][last][top][bottom][index][help] */