PageRenderTime 55ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/defs/netdefs.c

https://github.com/openj/core
C | 239 lines | 239 code | 0 blank | 0 comment | 1 complexity | ebe79e33fb75fe25c5cf05682f0accc3 MD5 | raw file
  1. #include <stdio.h>
  2. #ifdef _WIN32
  3. #include <winsock.h>
  4. #else
  5. #include <stdlib.h>
  6. #include <sys/socket.h>
  7. #ifdef sun
  8. #include <inet/tcp.h>
  9. #endif
  10. #ifdef ANDROID
  11. #include<linux/time.h>
  12. #endif
  13. #include <netdb.h>
  14. #include <netinet/in.h>
  15. #include <arpa/inet.h>
  16. #include <sys/ioctl.h>
  17. #endif
  18. #include <sys/types.h>
  19. #define offset(r,f) (((char*)&((r*)0)->f)-((char*)((r*)0)))
  20. main(){
  21. printf ("NB. do not edit -- created by sym2ijs\n\n");
  22. printf ("cocurrent <'jdefs'\n\n");
  23. printf ("FIONBIO=: %d\n",(int)FIONBIO);
  24. printf ("FIONREAD=: %d\n",(int)FIONREAD);
  25. printf ("FD_SETSIZE=: %d\n",(int)FD_SETSIZE);
  26. puts("");
  27. #ifdef _WIN32
  28. printf ("SD_RECEIVE=: %d\n",(int)SD_RECEIVE);
  29. printf ("SD_SEND=: %d\n",(int)SD_SEND);
  30. printf ("SD_BOTH=: %d\n",(int)SD_BOTH);
  31. #endif
  32. puts("");
  33. printf ("sockaddr_sz=: %d\n",(int)sizeof (struct sockaddr));
  34. printf ("sa_family_off=: %d\n",(int)offset(struct sockaddr,sa_family));
  35. printf ("sa_family_sz=: %d\n",(int)sizeof(((struct sockaddr*)0)->sa_family));
  36. printf ("sa_data_off=: %d\n",(int)offset(struct sockaddr,sa_data));
  37. printf ("sa_data_sz=: %d\n",(int)sizeof(((struct sockaddr*)0)->sa_data));
  38. puts("");
  39. printf ("sockaddr_in_sz=: %d\n",(int)sizeof (struct sockaddr_in));
  40. printf ("sin_family_off=: %d\n",(int)offset(struct sockaddr_in,sin_family));
  41. printf ("sin_family_sz=: %d\n",(int)sizeof(((struct sockaddr_in*)0)->sin_family));
  42. printf ("sin_port_off=: %d\n",(int)offset(struct sockaddr_in,sin_port));
  43. printf ("sin_port_sz=: %d\n",(int)sizeof(((struct sockaddr_in*)0)->sin_port));
  44. printf ("sin_addr_off=: %d\n",(int)offset(struct sockaddr_in,sin_addr));
  45. printf ("sin_addr_sz=: %d\n",(int)sizeof(((struct sockaddr_in*)0)->sin_addr));
  46. puts("");
  47. printf ("in_addr_sz=: %d\n",(int)sizeof (struct in_addr));
  48. printf ("s_addr_off=: %d\n",(int)offset(struct in_addr,s_addr));
  49. printf ("s_addr_sz=: %d\n",(int)sizeof(((struct in_addr*)0)->s_addr));
  50. puts("");
  51. printf ("hostent_sz=: %d\n",(int)sizeof (struct hostent));
  52. printf ("h_name_off=: %d\n",(int)offset(struct hostent,h_name));
  53. printf ("h_name_sz=: %d\n",(int)sizeof(((struct hostent*)0)->h_name));
  54. printf ("h_aliases_off=: %d\n",(int)offset(struct hostent,h_aliases));
  55. printf ("h_aliases_sz=: %d\n",(int)sizeof(((struct hostent*)0)->h_aliases));
  56. printf ("h_addrtype_off=: %d\n",(int)offset(struct hostent,h_addrtype));
  57. printf ("h_addrtype_sz=: %d\n",(int)sizeof(((struct hostent*)0)->h_addrtype));
  58. printf ("h_length_off=: %d\n",(int)offset(struct hostent,h_length));
  59. printf ("h_length_sz=: %d\n",(int)sizeof(((struct hostent*)0)->h_length));
  60. printf ("h_addr_list_off=: %d\n",(int)offset(struct hostent,h_addr_list));
  61. printf ("h_addr_list_sz=: %d\n",(int)sizeof(((struct hostent*)0)->h_addr_list));
  62. puts("");
  63. puts("");
  64. printf ("SIOCATMARK=: %d\n",(int)SIOCATMARK);
  65. puts("");
  66. puts("");
  67. printf ("IPPROTO_IP=: %d\n",(int)IPPROTO_IP);
  68. printf ("IPPROTO_ICMP=: %d\n",(int)IPPROTO_ICMP);
  69. printf ("IPPROTO_IGMP=: %d\n",(int)IPPROTO_IGMP);
  70. printf ("IPPROTO_TCP=: %d\n",(int)IPPROTO_TCP);
  71. printf ("IPPROTO_PUP=: %d\n",(int)IPPROTO_PUP);
  72. printf ("IPPROTO_UDP=: %d\n",(int)IPPROTO_UDP);
  73. printf ("IPPROTO_IDP=: %d\n",(int)IPPROTO_IDP);
  74. printf ("IPPROTO_RAW=: %d\n",(int)IPPROTO_RAW);
  75. printf ("IPPROTO_MAX=: %d\n",(int)IPPROTO_MAX);
  76. puts("");
  77. puts("");
  78. printf ("INADDR_ANY=: %d\n",(int)INADDR_ANY);
  79. printf ("INADDR_LOOPBACK=: %d\n",(int)INADDR_LOOPBACK);
  80. printf ("INADDR_BROADCAST=: %d\n",(int)INADDR_BROADCAST);
  81. #ifdef INADDR_NONE
  82. printf ("INADDR_NONE=: %d\n",(int)INADDR_NONE);
  83. #else
  84. puts ("INADDR_NONE=: _1");
  85. #endif
  86. puts("");
  87. #ifndef _WIN32
  88. printf ("INADDR_UNSPEC_GROUP=: %d\n",(int)INADDR_UNSPEC_GROUP);
  89. printf ("INADDR_ALLHOSTS_GROUP=: %d\n",(int)INADDR_ALLHOSTS_GROUP);
  90. printf ("INADDR_MAX_LOCAL_GROUP=: %d\n",(int)INADDR_MAX_LOCAL_GROUP);
  91. printf ("IN_LOOPBACKNET=: %d\n",(int)IN_LOOPBACKNET);
  92. #endif
  93. puts("");
  94. printf ("SOCK_STREAM=: %d\n",(int)SOCK_STREAM);
  95. printf ("SOCK_DGRAM=: %d\n",(int)SOCK_DGRAM);
  96. printf ("SOCK_RAW=: %d\n",(int)SOCK_RAW);
  97. printf ("SOCK_RDM=: %d\n",(int)SOCK_RDM);
  98. printf ("SOCK_SEQPACKET=: %d\n",(int)SOCK_SEQPACKET);
  99. puts("");
  100. printf ("SOL_SOCKET=: %d\n",(int)SOL_SOCKET);
  101. printf ("SO_DEBUG=: %d\n",(int)SO_DEBUG);
  102. printf ("SO_REUSEADDR=: %d\n",(int)SO_REUSEADDR);
  103. printf ("SO_KEEPALIVE=: %d\n",(int)SO_KEEPALIVE);
  104. printf ("SO_DONTROUTE=: %d\n",(int)SO_DONTROUTE);
  105. printf ("SO_BROADCAST=: %d\n",(int)SO_BROADCAST);
  106. printf ("SO_LINGER=: %d\n",(int)SO_LINGER);
  107. printf ("SO_OOBINLINE=: %d\n",(int)SO_OOBINLINE);
  108. puts("");
  109. printf ("SO_SNDBUF=: %d\n",(int)SO_SNDBUF);
  110. printf ("SO_RCVBUF=: %d\n",(int)SO_RCVBUF);
  111. printf ("SO_SNDLOWAT=: %d\n",(int)SO_SNDLOWAT);
  112. printf ("SO_RCVLOWAT=: %d\n",(int)SO_RCVLOWAT);
  113. printf ("SO_SNDTIMEO=: %d\n",(int)SO_SNDTIMEO);
  114. printf ("SO_RCVTIMEO=: %d\n",(int)SO_RCVTIMEO);
  115. printf ("SO_ERROR=: %d\n",(int)SO_ERROR);
  116. printf ("SO_TYPE=: %d\n",(int)SO_TYPE);
  117. puts("");
  118. printf ("linger_sz=: %d\n",(int)sizeof (struct linger));
  119. printf ("l_onoff_off=: %d\n",(int)offset(struct linger,l_onoff));
  120. printf ("l_onoff_sz=: %d\n",(int)sizeof(((struct linger*)0)->l_onoff));
  121. printf ("l_linger_off=: %d\n",(int)offset(struct linger,l_linger));
  122. printf ("l_linger_sz=: %d\n",(int)sizeof(((struct linger*)0)->l_linger));
  123. puts("");
  124. printf ("AF_UNSPEC=: %d\n",(int)AF_UNSPEC);
  125. printf ("AF_UNIX=: %d\n",(int)AF_UNIX);
  126. printf ("AF_INET=: %d\n",(int)AF_INET);
  127. printf ("AF_SNA=: %d\n",(int)AF_SNA);
  128. printf ("AF_DECnet=: %d\n",(int)AF_DECnet);
  129. printf ("AF_APPLETALK=: %d\n",(int)AF_APPLETALK);
  130. printf ("AF_IPX=: %d\n",(int)AF_IPX);
  131. printf ("AF_MAX=: %d\n",(int)AF_MAX);
  132. printf ("PF_UNSPEC=: %d\n",(int)PF_UNSPEC);
  133. printf ("PF_UNIX=: %d\n",(int)PF_UNIX);
  134. printf ("PF_INET=: %d\n",(int)PF_INET);
  135. printf ("PF_SNA=: %d\n",(int)PF_SNA);
  136. printf ("PF_DECnet=: %d\n",(int)PF_DECnet);
  137. printf ("PF_APPLETALK=: %d\n",(int)PF_APPLETALK);
  138. printf ("PF_IPX=: %d\n",(int)PF_IPX);
  139. printf ("PF_MAX=: %d\n",(int)PF_MAX);
  140. puts("");
  141. printf ("SOMAXCONN=: %d\n",(int)SOMAXCONN);
  142. printf ("MSG_OOB=: %d\n",(int)MSG_OOB);
  143. printf ("MSG_PEEK=: %d\n",(int)MSG_PEEK);
  144. printf ("MSG_DONTROUTE=: %d\n",(int)MSG_DONTROUTE);
  145. puts("");
  146. #ifndef _WIN32
  147. printf ("msghdr_sz=: %d\n",(int)sizeof (struct msghdr));
  148. printf ("msg_name_off=: %d\n",(int)offset(struct msghdr,msg_name));
  149. printf ("msg_name_sz=: %d\n",(int)sizeof(((struct msghdr*)0)->msg_name));
  150. printf ("msg_namelen_off=: %d\n",(int)offset(struct msghdr,msg_namelen));
  151. printf ("msg_namelen_sz=: %d\n",(int)sizeof(((struct msghdr*)0)->msg_namelen));
  152. printf ("msg_iov_off=: %d\n",(int)offset(struct msghdr,msg_iov));
  153. printf ("msg_iov_sz=: %d\n",(int)sizeof(((struct msghdr*)0)->msg_iov));
  154. printf ("msg_iovlen_off=: %d\n",(int)offset(struct msghdr,msg_iovlen));
  155. printf ("msg_iovlen_sz=: %d\n",(int)sizeof(((struct msghdr*)0)->msg_iovlen));
  156. #if defined(linux) || defined(Darwin)
  157. printf ("msg_control_off=: %d\n",(int)offset(struct msghdr,msg_control));
  158. printf ("msg_control_sz=: %d\n",(int)sizeof(((struct msghdr*)0)->msg_control));
  159. printf ("msg_controllen_off=: %d\n",(int)offset(struct msghdr,msg_controllen));
  160. printf ("msg_controllen_sz=: %d\n",(int)sizeof(((struct msghdr*)0)->msg_controllen));
  161. printf ("msg_flags_off=: %d\n",(int)offset(struct msghdr,msg_flags));
  162. printf ("msg_flags_sz=: %d\n",(int)sizeof(((struct msghdr*)0)->msg_flags));
  163. #else
  164. printf ("msg_accrights_off=: %d\n",(int)offset(struct msghdr,msg_accrights));
  165. printf ("msg_accrights_sz=: %d\n",(int)sizeof(((struct msghdr*)0)->msg_accrights));
  166. printf ("msg_accrightslen_off=: %d\n",(int)offset(struct msghdr,msg_accrightslen));
  167. printf ("msg_accrightslen_sz=: %d\n",(int)sizeof(((struct msghdr*)0)->msg_accrightslen));
  168. #endif
  169. #endif
  170. puts("");
  171. #ifdef _WIN32
  172. printf ("SOCKET_ERROR=: %d\n",(int)SOCKET_ERROR);
  173. printf ("FD_READ=: %d\n",(int)FD_READ);
  174. printf ("FD_WRITE=: %d\n",(int)FD_WRITE);
  175. printf ("FD_OOB=: %d\n",(int)FD_OOB);
  176. printf ("FD_ACCEPT=: %d\n",(int)FD_ACCEPT);
  177. printf ("FD_CONNECT=: %d\n",(int)FD_CONNECT);
  178. printf ("FD_CLOSE=: %d\n",(int)FD_CLOSE);
  179. printf ("WSABASEERR=: %d\n",(int)WSABASEERR);
  180. printf ("WSAEINTR=: %d\n",(int)WSAEINTR);
  181. printf ("WSAEBADF=: %d\n",(int)WSAEBADF);
  182. printf ("WSAEACCES=: %d\n",(int)WSAEACCES);
  183. printf ("WSAEFAULT=: %d\n",(int)WSAEFAULT);
  184. printf ("WSAEINVAL=: %d\n",(int)WSAEINVAL);
  185. printf ("WSAEMFILE=: %d\n",(int)WSAEMFILE);
  186. printf ("WSAEWOULDBLOCK=: %d\n",(int)WSAEWOULDBLOCK);
  187. printf ("WSAEINPROGRESS=: %d\n",(int)WSAEINPROGRESS);
  188. printf ("WSAEALREADY=: %d\n",(int)WSAEALREADY);
  189. printf ("WSAENOTSOCK=: %d\n",(int)WSAENOTSOCK);
  190. printf ("WSAEDESTADDRREQ=: %d\n",(int)WSAEDESTADDRREQ);
  191. printf ("WSAEMSGSIZE=: %d\n",(int)WSAEMSGSIZE);
  192. printf ("WSAEPROTOTYPE=: %d\n",(int)WSAEPROTOTYPE);
  193. printf ("WSAENOPROTOOPT=: %d\n",(int)WSAENOPROTOOPT);
  194. printf ("WSAEPROTONOSUPPORT=: %d\n",(int)WSAEPROTONOSUPPORT);
  195. printf ("WSAESOCKTNOSUPPORT=: %d\n",(int)WSAESOCKTNOSUPPORT);
  196. printf ("WSAEOPNOTSUPP=: %d\n",(int)WSAEOPNOTSUPP);
  197. printf ("WSAEPFNOSUPPORT=: %d\n",(int)WSAEPFNOSUPPORT);
  198. printf ("WSAEAFNOSUPPORT=: %d\n",(int)WSAEAFNOSUPPORT);
  199. printf ("WSAEADDRINUSE=: %d\n",(int)WSAEADDRINUSE);
  200. printf ("WSAEADDRNOTAVAIL=: %d\n",(int)WSAEADDRNOTAVAIL);
  201. printf ("WSAENETDOWN=: %d\n",(int)WSAENETDOWN);
  202. printf ("WSAENETUNREACH=: %d\n",(int)WSAENETUNREACH);
  203. printf ("WSAENETRESET=: %d\n",(int)WSAENETRESET);
  204. printf ("WSAECONNABORTED=: %d\n",(int)WSAECONNABORTED);
  205. printf ("WSAECONNRESET=: %d\n",(int)WSAECONNRESET);
  206. printf ("WSAENOBUFS=: %d\n",(int)WSAENOBUFS);
  207. printf ("WSAEISCONN=: %d\n",(int)WSAEISCONN);
  208. printf ("WSAENOTCONN=: %d\n",(int)WSAENOTCONN);
  209. printf ("WSAESHUTDOWN=: %d\n",(int)WSAESHUTDOWN);
  210. printf ("WSAETOOMANYREFS=: %d\n",(int)WSAETOOMANYREFS);
  211. printf ("WSAETIMEDOUT=: %d\n",(int)WSAETIMEDOUT);
  212. printf ("WSAECONNREFUSED=: %d\n",(int)WSAECONNREFUSED);
  213. printf ("WSAELOOP=: %d\n",(int)WSAELOOP);
  214. printf ("WSAENAMETOOLONG=: %d\n",(int)WSAENAMETOOLONG);
  215. printf ("WSAEHOSTDOWN=: %d\n",(int)WSAEHOSTDOWN);
  216. printf ("WSAEHOSTUNREACH=: %d\n",(int)WSAEHOSTUNREACH);
  217. printf ("WSAENOTEMPTY=: %d\n",(int)WSAENOTEMPTY);
  218. printf ("WSAEPROCLIM=: %d\n",(int)WSAEPROCLIM);
  219. printf ("WSAEUSERS=: %d\n",(int)WSAEUSERS);
  220. printf ("WSAEDQUOT=: %d\n",(int)WSAEDQUOT);
  221. printf ("WSAESTALE=: %d\n",(int)WSAESTALE);
  222. printf ("WSAEREMOTE=: %d\n",(int)WSAEREMOTE);
  223. printf ("WSASYSNOTREADY=: %d\n",(int)WSASYSNOTREADY);
  224. printf ("WSAVERNOTSUPPORTED=: %d\n",(int)WSAVERNOTSUPPORTED);
  225. printf ("WSANOTINITIALISED=: %d\n",(int)WSANOTINITIALISED);
  226. printf ("WSAHOST_NOT_FOUND=: %d\n",(int)WSAHOST_NOT_FOUND);
  227. printf ("HOST_NOT_FOUND=: %d\n",(int)HOST_NOT_FOUND);
  228. printf ("WSATRY_AGAIN=: %d\n",(int)WSATRY_AGAIN);
  229. printf ("TRY_AGAIN=: %d\n",(int)TRY_AGAIN);
  230. printf ("WSANO_RECOVERY=: %d\n",(int)WSANO_RECOVERY);
  231. printf ("NO_RECOVERY=: %d\n",(int)NO_RECOVERY);
  232. printf ("WSANO_DATA=: %d\n",(int)WSANO_DATA);
  233. printf ("NO_DATA=: %d\n",(int)NO_DATA);
  234. printf ("WSANO_ADDRESS=: %d\n",(int)WSANO_ADDRESS);
  235. printf ("NO_ADDRESS=: %d\n",(int)NO_ADDRESS);
  236. printf ("WM_USER=: %d\n",(int)WM_USER);
  237. #endif
  238. exit (0);
  239. }