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

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