Subversion Repositories HelenOS

Rev

Rev 4712 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (c) 2009 Lukas Mejdrech
  3.  * 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.  *
  9.  * - Redistributions of source code must retain the above copyright
  10.  *   notice, this list of conditions and the following disclaimer.
  11.  * - Redistributions in binary form must reproduce the above copyright
  12.  *   notice, this list of conditions and the following disclaimer in the
  13.  *   documentation and/or other materials provided with the distribution.
  14.  * - The name of the author may not be used to endorse or promote products
  15.  *   derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  */
  28.  
  29. /** @addtogroup socket
  30.  *  @{
  31.  */
  32.  
  33. /** @file
  34.  *  Socket codes and definitions.
  35.  *  This is a part of the network application library.
  36.  */
  37.  
  38. #ifndef __NET_SOCKET_CODES_H__
  39. #define __NET_SOCKET_CODES_H__
  40.  
  41. #include <sys/types.h>
  42.  
  43. /** @name Address families definitions
  44.  */
  45. /*@{*/
  46.  
  47. /** Unspecified address family.
  48.  */
  49. #define AF_UNSPEC   0
  50.  
  51. /** Unix domain sockets address family.
  52.  */
  53. #define AF_UNIXL    1
  54.  
  55. /** POSIX name for AF_UNIX address family.
  56.  */
  57. #define AF_LOCAL    1
  58.  
  59. /** Internet IP Protocol address family.
  60.  */
  61. #define AF_INET     2
  62.  
  63. /** Amateur Radio AX.25 address family.
  64.  */
  65. #define AF_AX25     3
  66.  
  67. /** Novell IPX address family.
  68.  */
  69. #define AF_IPX      4
  70.  
  71. /** AppleTalk DDP address family.
  72.  */
  73. #define AF_APPLETALK    5
  74.  
  75. /** Amateur Radio NET/ROM address family.
  76.  */
  77. #define AF_NETROM   6
  78.  
  79. /** Multiprotocol bridge address family.
  80.  */
  81. #define AF_BRIDGE   7
  82.  
  83. /** ATM PVCs address family.
  84.  */
  85. #define AF_ATMPVC   8
  86.  
  87. /** Reserved for X.25 project address family.
  88.  */
  89. #define AF_X25      9
  90.  
  91. /** IP version 6 address family.
  92.  */
  93. #define AF_INET6    10
  94.  
  95. /** Amateur Radio X.25 PLP address family.
  96.  */
  97. #define AF_ROSE     11
  98.  
  99. /** Reserved for DECnet project address family.
  100.  */
  101. #define AF_DECnet   12
  102.  
  103. /** Reserved for 802.2LLC project address family.
  104.  */
  105. #define AF_NETBEUI  13
  106.  
  107. /** Security callback pseudo AF address family.
  108.  */
  109. #define AF_SECURITY 14
  110.  
  111. /** PF_KEY key management API address family.
  112.  */
  113. #define AF_KEY      15
  114.  
  115. /** Alias to emulate 4.4BSD address family.
  116.  */
  117. #define AF_NETLINK  16
  118.  
  119. /** Packet family address family.
  120.  */
  121. #define AF_PACKET   17
  122.  
  123. /** Ash address family.
  124.  */
  125. #define AF_ASH      18
  126.  
  127. /** Acorn Econet address family.
  128.  */
  129. #define AF_ECONET   19
  130.  
  131. /** ATM SVCs address family.
  132.  */
  133. #define AF_ATMSVC   20
  134.  
  135. /** Linux SNA Project (nutters!) address family.
  136.  */
  137. #define AF_SNA      22
  138.  
  139. /** IRDA sockets address family.
  140.  */
  141. #define AF_IRDA     23
  142.  
  143. /** PPPoX sockets address family.
  144.  */
  145. #define AF_PPPOX    24
  146.  
  147. /** Wanpipe API Sockets address family.
  148.  */
  149. #define AF_WANPIPE  25
  150.  
  151. /** Linux LLC address family.
  152.  */
  153. #define AF_LLC      26
  154.  
  155. /** Controller Area Network address family.
  156.  */
  157. #define AF_CAN      29
  158.  
  159. /** TIPC sockets address family.
  160.  */
  161. #define AF_TIPC     30
  162.  
  163. /** Bluetooth sockets address family.
  164.  */
  165. #define AF_BLUETOOTH    31
  166.  
  167. /** IUCV sockets address family.
  168.  */
  169. #define AF_IUCV     32
  170.  
  171. /** RxRPC sockets address family.
  172.  */
  173. #define AF_RXRPC    33
  174.  
  175. /** Maximum address family.
  176.  */
  177. #define AF_MAX      34
  178.  
  179. /*@}*/
  180.  
  181. /** @name Protocol families definitions
  182.  *  Same as address families.
  183.  */
  184. /*@{*/
  185.  
  186. /** Unspecified protocol family.
  187.  */
  188. #define PF_UNSPEC   AF_UNSPEC
  189.  
  190. /** Unix domain sockets protocol family.
  191.  */
  192. #define PF_UNIXL    AF_UNIXL
  193.  
  194. /** POSIX name for AF_UNIX protocol family.
  195.  */
  196. #define PF_LOCAL    AF_LOCAL
  197.  
  198. /** Internet IP Protocol protocol family.
  199.  */
  200. #define PF_INET     AF_INET
  201.  
  202. /** Amateur Radio AX.25 protocol family.
  203.  */
  204. #define PF_AX25     AF_AX25
  205.  
  206. /** Novell IPX protocol family.
  207.  */
  208. #define PF_IPX      AF_IPX
  209.  
  210. /** AppleTalk DDP protocol family.
  211.  */
  212. #define PF_APPLETALK    AF_APPLETALK
  213.  
  214. /** Amateur Radio NET/ROM protocol family.
  215.  */
  216. #define PF_NETROM   AF_NETROM
  217.  
  218. /** Multiprotocol bridge protocol family.
  219.  */
  220. #define PF_BRIDGE   AF_BRIDGE
  221.  
  222. /** ATM PVCs protocol family.
  223.  */
  224. #define PF_ATMPVC   AF_ATMPVC
  225.  
  226. /** Reserved for X.25 project protocol family.
  227.  */
  228. #define PF_X25      AF_X25
  229.  
  230. /** IP version 6 protocol family.
  231.  */
  232. #define PF_INET6    AF_INET6
  233.  
  234. /** Amateur Radio X.25 PLP protocol family.
  235.  */
  236. #define PF_ROSE     AF_ROSE
  237.  
  238. /** Reserved for DECnet project protocol family.
  239.  */
  240. #define PF_DECnet   AF_DECnet
  241.  
  242. /** Reserved for 802.2LLC project protocol family.
  243.  */
  244. #define PF_NETBEUI  AF_NETBEUI
  245.  
  246. /** Security callback pseudo AF protocol family.
  247.  */
  248. #define PF_SECURITY AF_SECURITY
  249.  
  250. /** PF_KEY key management API protocol family.
  251.  */
  252. #define PF_KEY      AF_KEY
  253.  
  254. /** Alias to emulate 4.4BSD protocol family.
  255.  */
  256. #define PF_NETLINK  AF_NETLINK
  257.  
  258. /** Packet family protocol family.
  259.  */
  260. #define PF_PACKET   AF_PACKET
  261.  
  262. /** Ash protocol family.
  263.  */
  264. #define PF_ASH      AF_ASH
  265.  
  266. /** Acorn Econet protocol family.
  267.  */
  268. #define PF_ECONET   AF_ECONET
  269.  
  270. /** ATM SVCs protocol family.
  271.  */
  272. #define PF_ATMSVC   AF_ATMSVC
  273.  
  274. /** Linux SNA Project (nutters!) protocol family.
  275.  */
  276. #define PF_SNA      AF_SNA
  277.  
  278. /** IRDA sockets protocol family.
  279.  */
  280. #define PF_IRDA     AF_IRDA
  281.  
  282. /** PPPoX sockets protocol family.
  283.  */
  284. #define PF_PPPOX    AF_PPPOX
  285.  
  286. /** Wanpipe API Sockets protocol family.
  287.  */
  288. #define PF_WANPIPE  AF_WANPIPE
  289.  
  290. /** Linux LLC protocol family.
  291.  */
  292. #define PF_LLC      AF_LLC
  293.  
  294. /** Controller Area Network protocol family.
  295.  */
  296. #define PF_CAN      AF_CAN
  297.  
  298. /** TIPC sockets protocol family.
  299.  */
  300. #define PF_TIPC     AF_TIPC
  301.  
  302. /** Bluetooth sockets protocol family.
  303.  */
  304. #define PF_BLUETOOTH    AF_BLUETOOTH
  305.  
  306. /** IUCV sockets protocol family.
  307.  */
  308. #define PF_IUCV     AF_IUCV
  309.  
  310. /** RxRPC sockets protocol family.
  311.  */
  312. #define PF_RXRPC    AF_RXRPC
  313.  
  314. /** Maximum protocol family.
  315.  */
  316. #define PF_MAX      AF_MAX
  317.  
  318. /*@}*/
  319.  
  320. /** @name Socket option levels definitions
  321.  *  Thanks to BSD these must match IPPROTO_xxx
  322.  */
  323. /*@{*/
  324.  
  325. /** IP socket option level.
  326.  */
  327. #define SOL_IP      0
  328.  
  329. /** ICMP socket option level.
  330.  */
  331. #define SOL_ICMP    1
  332.  
  333. /** TCP socket option level.
  334.  */
  335. #define SOL_TCP     6
  336.  
  337. /** UDP socket option level.
  338.  */
  339. #define SOL_UDP     17
  340.  
  341. /** IPV socket option level.
  342.  */
  343. #define SOL_IPV6    41
  344.  
  345. /** ICMPV socket option level.
  346.  */
  347. #define SOL_ICMPV6  58
  348.  
  349. /** SCTP socket option level.
  350.  */
  351. #define SOL_SCTP    132
  352.  
  353. /** UDP-Lite (RFC 3828) socket option level.
  354.  */
  355. #define SOL_UDPLITE 136
  356.  
  357. /** RAW socket option level.
  358.  */
  359. #define SOL_RAW     255
  360.  
  361. /** IPX socket option level.
  362.  */
  363. #define SOL_IPX     256
  364.  
  365. /** AX socket option level.
  366.  */
  367. #define SOL_AX25    257
  368.  
  369. /** ATALK socket option level.
  370.  */
  371. #define SOL_ATALK   258
  372.  
  373. /** NETROM socket option level.
  374.  */
  375. #define SOL_NETROM  259
  376.  
  377. /** ROSE socket option level.
  378.  */
  379. #define SOL_ROSE    260
  380.  
  381. /** DECNET socket option level.
  382.  */
  383. #define SOL_DECNET  261
  384.  
  385. /** X25 socket option level.
  386.  */
  387. #define SOL_X25     262
  388.  
  389. /** PACKET socket option level.
  390.  */
  391. #define SOL_PACKET  263
  392.  
  393. /** ATM layer (cell level) socket option level.
  394.  */
  395. #define SOL_ATM     264
  396.  
  397. /** ATM Adaption Layer (packet level) socket option level.
  398.  */
  399. #define SOL_AAL     265
  400.  
  401. /** IRDA socket option level.
  402.  */
  403. #define SOL_IRDA    266
  404.  
  405. /** NETBEUI socket option level.
  406.  */
  407. #define SOL_NETBEUI 267
  408.  
  409. /** LLC socket option level.
  410.  */
  411. #define SOL_LLC     268
  412.  
  413. /** DCCP socket option level.
  414.  */
  415. #define SOL_DCCP    269
  416.  
  417. /** NETLINK socket option level.
  418.  */
  419. #define SOL_NETLINK 270
  420.  
  421. /** TIPC socket option level.
  422.  */
  423. #define SOL_TIPC    271
  424.  
  425. /** RXRPC socket option level.
  426.  */
  427. #define SOL_RXRPC   272
  428.  
  429. /** PPPOL socket option level.
  430.  */
  431. #define SOL_PPPOL2TP    273
  432.  
  433. /** BLUETOOTH socket option level.
  434.  */
  435. #define SOL_BLUETOOTH   274
  436.  
  437. /*@}*/
  438.  
  439. /** Socket types.
  440.  */
  441. typedef enum sock_type{
  442.     /** Stream (connection oriented) socket.
  443.      */
  444.     SOCK_STREAM = 1,
  445.     /** Datagram (connectionless oriented) socket.
  446.      */
  447.     SOCK_DGRAM  = 2,
  448.     /** Raw socket.
  449.      */
  450.     SOCK_RAW    = 3
  451. } sock_type_t;
  452.  
  453. /** Type definition of the socket length.
  454.  */
  455. typedef int32_t socklen_t;
  456.  
  457. #endif
  458.  
  459. /** @}
  460.  */
  461.