diff options
author | Yu Kobayashi <yukoba@accelart.jp> | 2013-07-30 13:15:41 +0900 |
---|---|---|
committer | Yu Kobayashi <yukoba@accelart.jp> | 2013-08-07 03:13:57 +0900 |
commit | 0a9dc0b0b23c8c22fc96ddaa063755f939e4ca6d (patch) | |
tree | 59a04a8d6491b7a6e967a974cf3f9c316ba75baf /system | |
parent | 1453cf0757f58249e6e3120da040557b41e93663 (diff) |
Add constants to network headers
Diffstat (limited to 'system')
-rw-r--r-- | system/include/libc/sys/signal.h | 4 | ||||
-rw-r--r-- | system/include/net/if.h | 21 | ||||
-rw-r--r-- | system/include/net/netinet/in.h | 67 | ||||
-rw-r--r-- | system/include/netdb.h | 36 | ||||
-rw-r--r-- | system/include/sys/ioctl.h | 58 | ||||
-rw-r--r-- | system/include/sys/select.h | 2 | ||||
-rw-r--r-- | system/include/sys/socket.h | 149 |
7 files changed, 308 insertions, 29 deletions
diff --git a/system/include/libc/sys/signal.h b/system/include/libc/sys/signal.h index 49a94d80..fc9b67d5 100644 --- a/system/include/libc/sys/signal.h +++ b/system/include/libc/sys/signal.h @@ -298,7 +298,9 @@ int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value)); #define SIGLOST 29 /* resource lost (eg, record-lock lost) */ #define SIGUSR1 30 /* user defined signal 1 */ #define SIGUSR2 31 /* user defined signal 2 */ -#define NSIG 32 /* signal 0 implied */ +#define NSIG 64 /* signal 0 implied */ +#define SIGRTMIN 32 +#define SIGRTMAX NSIG #endif #endif diff --git a/system/include/net/if.h b/system/include/net/if.h index dd7884aa..0ef18520 100644 --- a/system/include/net/if.h +++ b/system/include/net/if.h @@ -77,7 +77,26 @@ char *if_indextoname(unsigned int a, char *b); struct if_nameindex *if_nameindex(); void if_freenameindex(struct if_nameindex *a); - +#define IFF_UP 0x1 +#define IFF_BROADCAST 0x2 +#define IFF_DEBUG 0x4 +#define IFF_LOOPBACK 0x8 +#define IFF_POINTOPOINT 0x10 +#define IFF_NOTRAILERS 0x20 +#define IFF_RUNNING 0x40 +#define IFF_NOARP 0x80 +#define IFF_PROMISC 0x100 +#define IFF_ALLMULTI 0x200 +#define IFF_MASTER 0x400 +#define IFF_SLAVE 0x800 +#define IFF_MULTICAST 0x1000 +#define IFF_PORTSEL 0x2000 +#define IFF_AUTOMEDIA 0x4000 +#define IFF_DYNAMIC 0x8000 +#define IFF_LOWER_UP 0x10000 +#define IFF_DORMANT 0x20000 +#define IFF_ECHO 0x40000 +#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) #ifdef __cplusplus } diff --git a/system/include/net/netinet/in.h b/system/include/net/netinet/in.h index fba1a7b3..1d3952f5 100644 --- a/system/include/net/netinet/in.h +++ b/system/include/net/netinet/in.h @@ -11,11 +11,63 @@ extern "C" { enum { IPPROTO_IP = 0, -#define IPPROTO_IP IPPROTO_IP - IPPROTO_TCP = 1, -#define IPPROTO_TCP IPPROTO_TCP - IPPROTO_UDP = 2, -#define IPPROTO_UDP IPPROTO_UDP +#define IPPROTO_IP IPPROTO_IP + IPPROTO_HOPOPTS = 0, +#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS + IPPROTO_ICMP = 1, +#define IPPROTO_ICMP IPPROTO_ICMP + IPPROTO_IGMP = 2, +#define IPPROTO_IGMP IPPROTO_IGMP + IPPROTO_IPIP = 4, +#define IPPROTO_IPIP IPPROTO_IPIP + IPPROTO_TCP = 6, +#define IPPROTO_TCP IPPROTO_TCP + IPPROTO_EGP = 8, +#define IPPROTO_EGP IPPROTO_EGP + IPPROTO_PUP = 12, +#define IPPROTO_PUP IPPROTO_PUP + IPPROTO_UDP = 17, +#define IPPROTO_UDP IPPROTO_UDP + IPPROTO_IDP = 22, +#define IPPROTO_IDP IPPROTO_IDP + IPPROTO_TP = 29, +#define IPPROTO_TP IPPROTO_TP + IPPROTO_DCCP = 33, +#define IPPROTO_DCCP IPPROTO_DCCP + IPPROTO_IPV6 = 41, +#define IPPROTO_IPV6 IPPROTO_IPV6 + IPPROTO_ROUTING = 43, +#define IPPROTO_ROUTING IPPROTO_ROUTING + IPPROTO_FRAGMENT = 44, +#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT + IPPROTO_RSVP = 46, +#define IPPROTO_RSVP IPPROTO_RSVP + IPPROTO_GRE = 47, +#define IPPROTO_GRE IPPROTO_GRE + IPPROTO_ESP = 50, +#define IPPROTO_ESP IPPROTO_ESP + IPPROTO_AH = 51, +#define IPPROTO_AH IPPROTO_AH + IPPROTO_ICMPV6 = 58, +#define IPPROTO_ICMPV6 IPPROTO_ICMPV6 + IPPROTO_NONE = 59, +#define IPPROTO_NONE IPPROTO_NONE + IPPROTO_DSTOPTS = 60, +#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS + IPPROTO_MTP = 92, +#define IPPROTO_MTP IPPROTO_MTP + IPPROTO_ENCAP = 98, +#define IPPROTO_ENCAP IPPROTO_ENCAP + IPPROTO_PIM = 103, +#define IPPROTO_PIM IPPROTO_PIM + IPPROTO_COMP = 108, +#define IPPROTO_COMP IPPROTO_COMP + IPPROTO_SCTP = 132, +#define IPPROTO_SCTP IPPROTO_SCTP + IPPROTO_UDPLITE = 136, +#define IPPROTO_UDPLITE IPPROTO_UDPLITE + IPPROTO_RAW = 255, +#define IPPROTO_RAW IPPROTO_RAW IPPROTO_MAX }; @@ -75,6 +127,11 @@ struct ip_mreq { struct in_addr imr_interface; }; +#define IP_PMTUDISC_DONT 0 +#define IP_PMTUDISC_WANT 1 +#define IP_PMTUDISC_DO 2 +#define IP_PMTUDISC_PROBE 3 + #define IP_MULTICAST_IF 32 #define IP_MULTICAST_TTL 33 #define IP_MULTICAST_LOOP 34 diff --git a/system/include/netdb.h b/system/include/netdb.h index 48acdcc4..df74a117 100644 --- a/system/include/netdb.h +++ b/system/include/netdb.h @@ -11,6 +11,20 @@ extern "C" { #define NO_DATA 4 #define NO_ADDRESS 5 +#define AI_PASSIVE 0x0001 +#define AI_CANONNAME 0x0002 +#define AI_NUMERICHOST 0x0004 +#define AI_V4MAPPED 0x0008 +#define AI_ALL 0x0010 +#define AI_ADDRCONFIG 0x0020 +#ifdef __USE_GNU +# define AI_IDN 0x0040 +# define AI_CANONIDN 0x0080 +# define AI_IDN_ALLOW_UNASSIGNED 0x0100 +# define AI_IDN_USE_STD3_ASCII_RULES 0x0200 +#endif +#define AI_NUMERICSERV 0x0400 + #define EAI_ADDRFAMILY 1 #define EAI_AGAIN 2 #define EAI_BADFLAGS 3 @@ -47,6 +61,15 @@ extern "C" { #define IP_PASSSEC 18 #define IP_TRANSPARENT 19 +#define NI_MAXHOST 1025 +#define NI_MAXSERV 32 + +#define NI_NOFQDN 0x00000001 +#define NI_NUMERICHOST 0x00000002 +#define NI_NAMEREQD 0x00000004 +#define NI_NUMERICSERV 0x00000008 +#define NI_DGRAM 0x00000010 + typedef int socklen_t; struct addrinfo @@ -85,6 +108,19 @@ const char* hstrerror(int err); extern int h_errno; +struct servent { + char *s_name; + char **s_aliases; + int s_port; + char *s_proto; +}; + +struct servent *getservent(void); +struct servent *getservbyname(const char *name, const char *proto); +struct servent *getservbyport(int port, const char *proto); +void setservent(int stayopen); +void endservent(void); + #include <netinet/in.h> #ifdef __cplusplus diff --git a/system/include/sys/ioctl.h b/system/include/sys/ioctl.h index c54d4ccc..047329cb 100644 --- a/system/include/sys/ioctl.h +++ b/system/include/sys/ioctl.h @@ -5,9 +5,6 @@ extern "C" { #endif -#define SIOCGIFCONF 1 // bogus value -#define SIOCGIFNETMASK 2 // bogus value - #define TIOCGSIZE 80 // bogus #define TIOCGWINSZ 80 // bogus @@ -19,6 +16,61 @@ int ioctl(int d, int request, ...); #define SO_RCVTIMEO 1000 #define SO_SNDTIMEO 2000 +#define SIOCADDRT 0x890B +#define SIOCDELRT 0x890C +#define SIOCRTMSG 0x890D +#define SIOCGIFNAME 0x8910 +#define SIOCSIFLINK 0x8911 +#define SIOCGIFCONF 0x8912 +#define SIOCGIFFLAGS 0x8913 +#define SIOCSIFFLAGS 0x8914 +#define SIOCGIFADDR 0x8915 +#define SIOCSIFADDR 0x8916 +#define SIOCGIFDSTADDR 0x8917 +#define SIOCSIFDSTADDR 0x8918 +#define SIOCGIFBRDADDR 0x8919 +#define SIOCSIFBRDADDR 0x891a +#define SIOCGIFNETMASK 0x891b +#define SIOCSIFNETMASK 0x891c +#define SIOCGIFMETRIC 0x891d +#define SIOCSIFMETRIC 0x891e +#define SIOCGIFMEM 0x891f +#define SIOCSIFMEM 0x8920 +#define SIOCGIFMTU 0x8921 +#define SIOCSIFMTU 0x8922 +#define SIOCSIFNAME 0x8923 +#define SIOCSIFHWADDR 0x8924 +#define SIOCGIFENCAP 0x8925 +#define SIOCSIFENCAP 0x8926 +#define SIOCGIFHWADDR 0x8927 +#define SIOCGIFSLAVE 0x8929 +#define SIOCSIFSLAVE 0x8930 +#define SIOCADDMULTI 0x8931 +#define SIOCDELMULTI 0x8932 +#define SIOCGIFINDEX 0x8933 +#define SIOGIFINDEX SIOCGIFINDEX +#define SIOCSIFPFLAGS 0x8934 +#define SIOCGIFPFLAGS 0x8935 +#define SIOCDIFADDR 0x8936 +#define SIOCSIFHWBROADCAST 0x8937 +#define SIOCGIFCOUNT 0x8938 +#define SIOCGIFBR 0x8940 +#define SIOCSIFBR 0x8941 +#define SIOCGIFTXQLEN 0x8942 +#define SIOCSIFTXQLEN 0x8943 +#define SIOCDARP 0x8953 +#define SIOCGARP 0x8954 +#define SIOCSARP 0x8955 +#define SIOCDRARP 0x8960 +#define SIOCGRARP 0x8961 +#define SIOCSRARP 0x8962 +#define SIOCGIFMAP 0x8970 +#define SIOCSIFMAP 0x8971 +#define SIOCADDDLCI 0x8980 +#define SIOCDELDLCI 0x8981 +#define SIOCDEVPRIVATE 0x89F0 +#define SIOCPROTOPRIVATE 0x89E0 + #ifdef __cplusplus } #endif diff --git a/system/include/sys/select.h b/system/include/sys/select.h index a5c73147..d6957fea 100644 --- a/system/include/sys/select.h +++ b/system/include/sys/select.h @@ -1,6 +1,8 @@ #ifndef _SELECT_H #define _SELECT_H +#include <unistd.h> + #ifdef __cplusplus extern "C" { #endif diff --git a/system/include/sys/socket.h b/system/include/sys/socket.h index 9650bb9a..7f10ebcb 100644 --- a/system/include/sys/socket.h +++ b/system/include/sys/socket.h @@ -4,24 +4,115 @@ #include <netdb.h> #include <sys/select.h> #include <sys/uio.h> +#include <unistd.h> #ifdef __cplusplus extern "C" { #endif // Note that the values of these constants are mostly arbitrary numbers. -#define SOMAXCONN 128 -#define PF_LOCAL 1 -#define PF_UNIX PF_LOCAL -#define PF_INET 2 -#define SO_BROADCAST 6 -#define AF_UNIX PF_UNIX +#define SOCK_STREAM 1 +#define SOCK_DGRAM 2 +#define SOCK_RAW 3 +#define SOCK_RDM 4 +#define SOCK_SEQPACKET 5 +#define SOCK_DCCP 6 +#define SOCK_PACKET 10 +#define SOCK_CLOEXEC 02000000 +#define SOCK_NONBLOCK 04000 + +#define PF_UNSPEC 0 +#define PF_LOCAL 1 +#define PF_UNIX PF_LOCAL +#define PF_FILE PF_LOCAL +#define PF_INET 2 +#define PF_AX25 3 +#define PF_IPX 4 +#define PF_APPLETALK 5 +#define PF_NETROM 6 +#define PF_BRIDGE 7 +#define PF_ATMPVC 8 +#define PF_X25 9 +#define PF_INET6 10 +#define PF_ROSE 11 +#define PF_DECnet 12 +#define PF_NETBEUI 13 +#define PF_SECURITY 14 +#define PF_KEY 15 +#define PF_NETLINK 16 +#define PF_ROUTE PF_NETLINK +#define PF_PACKET 17 +#define PF_ASH 18 +#define PF_ECONET 19 +#define PF_ATMSVC 20 +#define PF_RDS 21 +#define PF_SNA 22 +#define PF_IRDA 23 +#define PF_PPPOX 24 +#define PF_WANPIPE 25 +#define PF_LLC 26 +#define PF_CAN 29 +#define PF_TIPC 30 +#define PF_BLUETOOTH 31 +#define PF_IUCV 32 +#define PF_RXRPC 33 +#define PF_ISDN 34 +#define PF_PHONET 35 +#define PF_IEEE802154 36 +#define PF_CAIF 37 +#define PF_ALG 38 +#define PF_NFC 39 +#define PF_MAX 40 + +#define AF_UNSPEC PF_UNSPEC +#define AF_LOCAL PF_LOCAL +#define AF_UNIX PF_UNIX +#define AF_FILE PF_FILE +#define AF_INET PF_INET +#define AF_AX25 PF_AX25 +#define AF_IPX PF_IPX +#define AF_APPLETALK PF_APPLETALK +#define AF_NETROM PF_NETROM +#define AF_BRIDGE PF_BRIDGE +#define AF_ATMPVC PF_ATMPVC +#define AF_X25 PF_X25 +#define AF_INET6 PF_INET6 +#define AF_ROSE PF_ROSE +#define AF_DECnet PF_DECnet +#define AF_NETBEUI PF_NETBEUI +#define AF_SECURITY PF_SECURITY +#define AF_KEY PF_KEY +#define AF_NETLINK PF_NETLINK +#define AF_ROUTE PF_ROUTE +#define AF_PACKET PF_PACKET +#define AF_ASH PF_ASH +#define AF_ECONET PF_ECONET +#define AF_ATMSVC PF_ATMSVC +#define AF_RDS PF_RDS +#define AF_SNA PF_SNA +#define AF_IRDA PF_IRDA +#define AF_PPPOX PF_PPPOX +#define AF_WANPIPE PF_WANPIPE +#define AF_LLC PF_LLC +#define AF_CAN PF_CAN +#define AF_TIPC PF_TIPC +#define AF_BLUETOOTH PF_BLUETOOTH +#define AF_IUCV PF_IUCV +#define AF_RXRPC PF_RXRPC +#define AF_ISDN PF_ISDN +#define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG +#define AF_NFC PF_NFC +#define AF_MAX PF_MAX -#define AF_UNSPEC 0 -#define SOCK_STREAM 200 #define SOL_SOCKET 50 + +#define SOMAXCONN 128 + +#define SO_BROADCAST 6 #define SO_ERROR 10 -#define SOCK_DGRAM 20 #define SO_REUSEADDR 30 #define SO_SNDBUF 40 #define SO_RCVBUF 60 @@ -34,14 +125,41 @@ extern "C" { #define SO_LINGER 130 #define SO_BSDCOMPAT 140 +#define MSG_OOB 0x01 +#define MSG_PEEK 0x02 +#define MSG_DONTROUTE 0x04 +#ifdef __USE_GNU +# define MSG_TRYHARD MSG_DONTROUTE +#endif +#define MSG_CTRUNC 0x08 +#define MSG_PROXY 0x10 +#define MSG_TRUNC 0x20 +#define MSG_DONTWAIT 0x40 +#define MSG_EOR 0x80 +#define MSG_WAITALL 0x100 +#define MSG_FIN 0x200 +#define MSG_SYN 0x400 +#define MSG_CONFIRM 0x800 +#define MSG_RST 0x1000 +#define MSG_ERRQUEUE 0x2000 +#define MSG_NOSIGNAL 0x4000 +#define MSG_MORE 0x8000 +#define MSG_WAITFORONE 0x10000 +#define MSG_CMSG_CLOEXEC 0x40000000 + #define SHUT_RD 0 #define SHUT_WR 1 #define SHUT_RDWR 2 +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#define SIOCGSTAMP 0x8906 +#define SIOCGSTAMPNS 0x8907 + typedef unsigned int sa_family_t; -#define AF_INET PF_INET -#define AF_INET6 6 -#define PF_INET6 AF_INET6 struct sockaddr { sa_family_t sa_family; @@ -87,13 +205,6 @@ struct linger { int l_linger; }; -#define SIOCATMARK 0x8905 - -#define SOCK_RAW 111 -#define SOCK_SEQPACKET 555 - -#define PF_APPLETALK 5 - #ifdef __cplusplus } #endif |