[57716a5] | 1 | /* |
---|
| 2 | * $Id$ |
---|
| 3 | */ |
---|
| 4 | |
---|
[fd0047e] | 5 | /**************************************************************************** |
---|
| 6 | * * |
---|
| 7 | * GNAT SYSTEM UTILITIES * |
---|
| 8 | * * |
---|
| 9 | * G E N - S O C C O N * |
---|
| 10 | * * |
---|
[58ff82d] | 11 | * Copyright (C) 2004-2008, Free Software Foundation, Inc. * |
---|
[fd0047e] | 12 | * * |
---|
| 13 | * GNAT is free software; you can redistribute it and/or modify it under * |
---|
| 14 | * terms of the GNU General Public License as published by the Free Soft- * |
---|
| 15 | * ware Foundation; either version 2, or (at your option) any later ver- * |
---|
| 16 | * sion. GNAT is distributed in the hope that it will be useful, but WITH- * |
---|
| 17 | * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * |
---|
| 18 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * |
---|
| 19 | * for more details. You should have received a copy of the GNU General * |
---|
| 20 | * Public License distributed with GNAT; see file COPYING. If not, write * |
---|
| 21 | * to the Free Software Foundation, 51 Franklin Street, Fifth Floor, * |
---|
| 22 | * Boston, MA 02110-1301, USA. * |
---|
| 23 | * * |
---|
| 24 | * GNAT was originally developed by the GNAT team at New York University. * |
---|
| 25 | * Extensive contributions were provided by Ada Core Technologies Inc. * |
---|
| 26 | * * |
---|
| 27 | ****************************************************************************/ |
---|
| 28 | |
---|
| 29 | /* This program generates g-soccon.ads */ |
---|
| 30 | |
---|
[36fcd41] | 31 | /* |
---|
| 32 | * To build using DEC C: |
---|
| 33 | * |
---|
| 34 | * CC/DEFINE="TARGET=""OpenVMS""" gen-soccon |
---|
| 35 | * LINK gen-soccon |
---|
| 36 | * RUN gen-soccon |
---|
| 37 | * |
---|
| 38 | * Note: OpenVMS versions older than 8.3 provide an incorrect value in |
---|
| 39 | * the DEC C header files for MSG_WAITALL. To generate the VMS version |
---|
| 40 | * of g-soccon.ads, gen-soccon should be run on an 8.3 or later machine. |
---|
| 41 | */ |
---|
[fd0047e] | 42 | |
---|
| 43 | #ifndef TARGET |
---|
| 44 | # error Please define TARGET |
---|
| 45 | #endif |
---|
| 46 | |
---|
| 47 | #include <stdlib.h> |
---|
| 48 | #include <stdio.h> |
---|
| 49 | #include <string.h> |
---|
| 50 | #include <limits.h> |
---|
| 51 | |
---|
| 52 | #ifdef __MINGW32__ |
---|
| 53 | #include <fcntl.h> |
---|
| 54 | #endif |
---|
| 55 | |
---|
| 56 | #include "gsocket.h" |
---|
| 57 | |
---|
[58ff82d] | 58 | typedef enum { NUM, TXT } kind_t; |
---|
| 59 | |
---|
[fd0047e] | 60 | struct line { |
---|
| 61 | char *text; |
---|
| 62 | char *value; |
---|
| 63 | char *comment; |
---|
[58ff82d] | 64 | kind_t kind; |
---|
[fd0047e] | 65 | struct line *next; |
---|
| 66 | }; |
---|
| 67 | |
---|
| 68 | struct line *first = NULL, *last = NULL; |
---|
| 69 | |
---|
[58ff82d] | 70 | #define TXT(_text) add_line(_text, NULL, NULL, TXT); |
---|
[fd0047e] | 71 | /* Plain text */ |
---|
| 72 | |
---|
| 73 | #define _NL TXT("") |
---|
| 74 | /* Empty line */ |
---|
| 75 | |
---|
| 76 | #define itoad(n) f_itoa ("%d", (n)) |
---|
| 77 | #define itoax(n) f_itoa ("16#%08x#", (n)) |
---|
| 78 | |
---|
[58ff82d] | 79 | #define CND(name,comment) add_line(#name, itoad (name), comment, NUM); |
---|
[fd0047e] | 80 | /* Constant (decimal) */ |
---|
| 81 | |
---|
[58ff82d] | 82 | #define CNX(name,comment) add_line(#name, itoax (name), comment, NUM); |
---|
[fd0047e] | 83 | /* Constant (hexadecimal) */ |
---|
| 84 | |
---|
[58ff82d] | 85 | #define CN_(name,comment) add_line(#name, name, comment, TXT); |
---|
[fd0047e] | 86 | /* Constant (generic) */ |
---|
| 87 | |
---|
| 88 | #define STR(p) STR1(p) |
---|
| 89 | #define STR1(p) #p |
---|
| 90 | |
---|
| 91 | void output (void); |
---|
| 92 | /* Generate output spec */ |
---|
| 93 | |
---|
| 94 | char *f_itoa (char *, int); |
---|
| 95 | /* int to string */ |
---|
| 96 | |
---|
[58ff82d] | 97 | void add_line (char *, char*, char*, kind_t); |
---|
[fd0047e] | 98 | |
---|
| 99 | #ifdef __MINGW32__ |
---|
| 100 | unsigned int _CRT_fmode = _O_BINARY; |
---|
| 101 | #endif |
---|
| 102 | |
---|
| 103 | int |
---|
| 104 | main (void) { |
---|
| 105 | |
---|
| 106 | TXT("------------------------------------------------------------------------------") |
---|
| 107 | TXT("-- --") |
---|
| 108 | TXT("-- GNAT COMPILER COMPONENTS --") |
---|
| 109 | TXT("-- --") |
---|
| 110 | TXT("-- G N A T . S O C K E T S . C O N S T A N T S --") |
---|
| 111 | TXT("-- --") |
---|
| 112 | TXT("-- S p e c --") |
---|
| 113 | TXT("-- --") |
---|
[58ff82d] | 114 | TXT("-- Copyright (C) 2000-2008, Free Software Foundation, Inc. --") |
---|
[fd0047e] | 115 | TXT("-- --") |
---|
| 116 | TXT("-- GNAT is free software; you can redistribute it and/or modify it under --") |
---|
| 117 | TXT("-- terms of the GNU General Public License as published by the Free Soft- --") |
---|
| 118 | TXT("-- ware Foundation; either version 2, or (at your option) any later ver- --") |
---|
| 119 | TXT("-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --") |
---|
| 120 | TXT("-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --") |
---|
| 121 | TXT("-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --") |
---|
| 122 | TXT("-- for more details. You should have received a copy of the GNU General --") |
---|
| 123 | TXT("-- Public License distributed with GNAT; see file COPYING. If not, write --") |
---|
| 124 | TXT("-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --") |
---|
| 125 | TXT("-- Boston, MA 02110-1301, USA. --") |
---|
| 126 | TXT("-- --") |
---|
| 127 | TXT("-- As a special exception, if other files instantiate generics from this --") |
---|
| 128 | TXT("-- unit, or you link this unit with other files to produce an executable, --") |
---|
| 129 | TXT("-- this unit does not by itself cause the resulting executable to be --") |
---|
| 130 | TXT("-- covered by the GNU General Public License. This exception does not --") |
---|
| 131 | TXT("-- however invalidate any other reasons why the executable file might be --") |
---|
| 132 | TXT("-- covered by the GNU Public License. --") |
---|
| 133 | TXT("-- --") |
---|
| 134 | TXT("-- GNAT was originally developed by the GNAT team at New York University. --") |
---|
| 135 | TXT("-- Extensive contributions were provided by Ada Core Technologies Inc. --") |
---|
| 136 | TXT("-- --") |
---|
| 137 | TXT("------------------------------------------------------------------------------") |
---|
| 138 | _NL |
---|
| 139 | TXT("-- This package provides target dependent definitions of constant for use") |
---|
| 140 | TXT("-- by the GNAT.Sockets package (g-socket.ads). This package should not be") |
---|
| 141 | TXT("-- directly with'ed by an applications program.") |
---|
| 142 | _NL |
---|
| 143 | TXT("-- This is the version for " TARGET) |
---|
| 144 | TXT("-- This file is generated automatically, do not modify it by hand! Instead,") |
---|
| 145 | TXT("-- make changes to gen-soccon.c and re-run it on each target.") |
---|
| 146 | _NL |
---|
[58ff82d] | 147 | TXT("with Interfaces.C;") |
---|
[fd0047e] | 148 | TXT("package GNAT.Sockets.Constants is") |
---|
| 149 | _NL |
---|
| 150 | TXT(" --------------") |
---|
| 151 | TXT(" -- Families --") |
---|
| 152 | TXT(" --------------") |
---|
| 153 | _NL |
---|
| 154 | |
---|
| 155 | #ifndef AF_INET |
---|
[58ff82d] | 156 | # define AF_INET -1 |
---|
[fd0047e] | 157 | #endif |
---|
| 158 | CND(AF_INET, "IPv4 address family") |
---|
| 159 | |
---|
| 160 | #ifndef AF_INET6 |
---|
[58ff82d] | 161 | # define AF_INET6 -1 |
---|
| 162 | #else |
---|
| 163 | #ifndef __rtems__ |
---|
| 164 | # define HAVE_AF_INET6 1 |
---|
| 165 | #endif |
---|
[fd0047e] | 166 | #endif |
---|
| 167 | CND(AF_INET6, "IPv6 address family") |
---|
| 168 | _NL |
---|
| 169 | TXT(" -----------") |
---|
| 170 | TXT(" -- Modes --") |
---|
| 171 | TXT(" -----------") |
---|
| 172 | _NL |
---|
| 173 | |
---|
| 174 | #ifndef SOCK_STREAM |
---|
| 175 | #define SOCK_STREAM -1 |
---|
| 176 | #endif |
---|
| 177 | CND(SOCK_STREAM, "Stream socket") |
---|
| 178 | |
---|
| 179 | #ifndef SOCK_DGRAM |
---|
| 180 | #define SOCK_DGRAM -1 |
---|
| 181 | #endif |
---|
| 182 | CND(SOCK_DGRAM, "Datagram socket") |
---|
| 183 | _NL |
---|
| 184 | TXT(" -------------------") |
---|
| 185 | TXT(" -- Socket errors --") |
---|
| 186 | TXT(" -------------------") |
---|
| 187 | _NL |
---|
| 188 | |
---|
| 189 | #ifndef EACCES |
---|
| 190 | #define EACCES -1 |
---|
| 191 | #endif |
---|
| 192 | CND(EACCES, "Permission denied") |
---|
| 193 | |
---|
| 194 | #ifndef EADDRINUSE |
---|
| 195 | #define EADDRINUSE -1 |
---|
| 196 | #endif |
---|
| 197 | CND(EADDRINUSE, "Address already in use") |
---|
| 198 | |
---|
| 199 | #ifndef EADDRNOTAVAIL |
---|
| 200 | #define EADDRNOTAVAIL -1 |
---|
| 201 | #endif |
---|
| 202 | CND(EADDRNOTAVAIL, "Cannot assign address") |
---|
| 203 | |
---|
| 204 | #ifndef EAFNOSUPPORT |
---|
| 205 | #define EAFNOSUPPORT -1 |
---|
| 206 | #endif |
---|
| 207 | CND(EAFNOSUPPORT, "Addr family not supported") |
---|
| 208 | |
---|
| 209 | #ifndef EALREADY |
---|
| 210 | #define EALREADY -1 |
---|
| 211 | #endif |
---|
| 212 | CND(EALREADY, "Operation in progress") |
---|
| 213 | |
---|
| 214 | #ifndef EBADF |
---|
| 215 | #define EBADF -1 |
---|
| 216 | #endif |
---|
| 217 | CND(EBADF, "Bad file descriptor") |
---|
| 218 | |
---|
| 219 | #ifndef ECONNABORTED |
---|
| 220 | #define ECONNABORTED -1 |
---|
| 221 | #endif |
---|
| 222 | CND(ECONNABORTED, "Connection aborted") |
---|
| 223 | |
---|
| 224 | #ifndef ECONNREFUSED |
---|
| 225 | #define ECONNREFUSED -1 |
---|
| 226 | #endif |
---|
| 227 | CND(ECONNREFUSED, "Connection refused") |
---|
| 228 | |
---|
| 229 | #ifndef ECONNRESET |
---|
| 230 | #define ECONNRESET -1 |
---|
| 231 | #endif |
---|
| 232 | CND(ECONNRESET, "Connection reset by peer") |
---|
| 233 | |
---|
| 234 | #ifndef EDESTADDRREQ |
---|
| 235 | #define EDESTADDRREQ -1 |
---|
| 236 | #endif |
---|
| 237 | CND(EDESTADDRREQ, "Destination addr required") |
---|
| 238 | |
---|
| 239 | #ifndef EFAULT |
---|
| 240 | #define EFAULT -1 |
---|
| 241 | #endif |
---|
| 242 | CND(EFAULT, "Bad address") |
---|
| 243 | |
---|
| 244 | #ifndef EHOSTDOWN |
---|
| 245 | #define EHOSTDOWN -1 |
---|
| 246 | #endif |
---|
| 247 | CND(EHOSTDOWN, "Host is down") |
---|
| 248 | |
---|
| 249 | #ifndef EHOSTUNREACH |
---|
| 250 | #define EHOSTUNREACH -1 |
---|
| 251 | #endif |
---|
| 252 | CND(EHOSTUNREACH, "No route to host") |
---|
| 253 | |
---|
| 254 | #ifndef EINPROGRESS |
---|
| 255 | #define EINPROGRESS -1 |
---|
| 256 | #endif |
---|
| 257 | CND(EINPROGRESS, "Operation now in progress") |
---|
| 258 | |
---|
| 259 | #ifndef EINTR |
---|
| 260 | #define EINTR -1 |
---|
| 261 | #endif |
---|
| 262 | CND(EINTR, "Interrupted system call") |
---|
| 263 | |
---|
| 264 | #ifndef EINVAL |
---|
| 265 | #define EINVAL -1 |
---|
| 266 | #endif |
---|
| 267 | CND(EINVAL, "Invalid argument") |
---|
| 268 | |
---|
| 269 | #ifndef EIO |
---|
| 270 | #define EIO -1 |
---|
| 271 | #endif |
---|
| 272 | CND(EIO, "Input output error") |
---|
| 273 | |
---|
| 274 | #ifndef EISCONN |
---|
| 275 | #define EISCONN -1 |
---|
| 276 | #endif |
---|
| 277 | CND(EISCONN, "Socket already connected") |
---|
| 278 | |
---|
| 279 | #ifndef ELOOP |
---|
| 280 | #define ELOOP -1 |
---|
| 281 | #endif |
---|
[58ff82d] | 282 | CND(ELOOP, "Too many symbolic links") |
---|
[fd0047e] | 283 | |
---|
| 284 | #ifndef EMFILE |
---|
| 285 | #define EMFILE -1 |
---|
| 286 | #endif |
---|
| 287 | CND(EMFILE, "Too many open files") |
---|
| 288 | |
---|
| 289 | #ifndef EMSGSIZE |
---|
| 290 | #define EMSGSIZE -1 |
---|
| 291 | #endif |
---|
| 292 | CND(EMSGSIZE, "Message too long") |
---|
| 293 | |
---|
| 294 | #ifndef ENAMETOOLONG |
---|
| 295 | #define ENAMETOOLONG -1 |
---|
| 296 | #endif |
---|
| 297 | CND(ENAMETOOLONG, "Name too long") |
---|
| 298 | |
---|
| 299 | #ifndef ENETDOWN |
---|
| 300 | #define ENETDOWN -1 |
---|
| 301 | #endif |
---|
| 302 | CND(ENETDOWN, "Network is down") |
---|
| 303 | |
---|
| 304 | #ifndef ENETRESET |
---|
| 305 | #define ENETRESET -1 |
---|
| 306 | #endif |
---|
| 307 | CND(ENETRESET, "Disconn. on network reset") |
---|
| 308 | |
---|
| 309 | #ifndef ENETUNREACH |
---|
| 310 | #define ENETUNREACH -1 |
---|
| 311 | #endif |
---|
| 312 | CND(ENETUNREACH, "Network is unreachable") |
---|
| 313 | |
---|
| 314 | #ifndef ENOBUFS |
---|
| 315 | #define ENOBUFS -1 |
---|
| 316 | #endif |
---|
| 317 | CND(ENOBUFS, "No buffer space available") |
---|
| 318 | |
---|
| 319 | #ifndef ENOPROTOOPT |
---|
| 320 | #define ENOPROTOOPT -1 |
---|
| 321 | #endif |
---|
| 322 | CND(ENOPROTOOPT, "Protocol not available") |
---|
| 323 | |
---|
| 324 | #ifndef ENOTCONN |
---|
| 325 | #define ENOTCONN -1 |
---|
| 326 | #endif |
---|
| 327 | CND(ENOTCONN, "Socket not connected") |
---|
| 328 | |
---|
| 329 | #ifndef ENOTSOCK |
---|
| 330 | #define ENOTSOCK -1 |
---|
| 331 | #endif |
---|
| 332 | CND(ENOTSOCK, "Operation on non socket") |
---|
| 333 | |
---|
| 334 | #ifndef EOPNOTSUPP |
---|
| 335 | #define EOPNOTSUPP -1 |
---|
| 336 | #endif |
---|
| 337 | CND(EOPNOTSUPP, "Operation not supported") |
---|
| 338 | |
---|
| 339 | #ifndef EPFNOSUPPORT |
---|
| 340 | #define EPFNOSUPPORT -1 |
---|
| 341 | #endif |
---|
| 342 | CND(EPFNOSUPPORT, "Unknown protocol family") |
---|
| 343 | |
---|
| 344 | #ifndef EPROTONOSUPPORT |
---|
| 345 | #define EPROTONOSUPPORT -1 |
---|
| 346 | #endif |
---|
| 347 | CND(EPROTONOSUPPORT, "Unknown protocol") |
---|
| 348 | |
---|
| 349 | #ifndef EPROTOTYPE |
---|
| 350 | #define EPROTOTYPE -1 |
---|
| 351 | #endif |
---|
| 352 | CND(EPROTOTYPE, "Unknown protocol type") |
---|
| 353 | |
---|
| 354 | #ifndef ESHUTDOWN |
---|
| 355 | #define ESHUTDOWN -1 |
---|
| 356 | #endif |
---|
| 357 | CND(ESHUTDOWN, "Cannot send once shutdown") |
---|
| 358 | |
---|
| 359 | #ifndef ESOCKTNOSUPPORT |
---|
| 360 | #define ESOCKTNOSUPPORT -1 |
---|
| 361 | #endif |
---|
| 362 | CND(ESOCKTNOSUPPORT, "Socket type not supported") |
---|
| 363 | |
---|
| 364 | #ifndef ETIMEDOUT |
---|
| 365 | #define ETIMEDOUT -1 |
---|
| 366 | #endif |
---|
| 367 | CND(ETIMEDOUT, "Connection timed out") |
---|
| 368 | |
---|
| 369 | #ifndef ETOOMANYREFS |
---|
| 370 | #define ETOOMANYREFS -1 |
---|
| 371 | #endif |
---|
| 372 | CND(ETOOMANYREFS, "Too many references") |
---|
| 373 | |
---|
| 374 | #ifndef EWOULDBLOCK |
---|
| 375 | #define EWOULDBLOCK -1 |
---|
| 376 | #endif |
---|
| 377 | CND(EWOULDBLOCK, "Operation would block") |
---|
| 378 | _NL |
---|
| 379 | TXT(" -----------------") |
---|
| 380 | TXT(" -- Host errors --") |
---|
| 381 | TXT(" -----------------") |
---|
| 382 | _NL |
---|
| 383 | |
---|
| 384 | #ifndef HOST_NOT_FOUND |
---|
| 385 | #define HOST_NOT_FOUND -1 |
---|
| 386 | #endif |
---|
| 387 | CND(HOST_NOT_FOUND, "Unknown host") |
---|
| 388 | |
---|
| 389 | #ifndef TRY_AGAIN |
---|
| 390 | #define TRY_AGAIN -1 |
---|
| 391 | #endif |
---|
| 392 | CND(TRY_AGAIN, "Host name lookup failure") |
---|
| 393 | |
---|
| 394 | #ifndef NO_DATA |
---|
| 395 | #define NO_DATA -1 |
---|
| 396 | #endif |
---|
| 397 | CND(NO_DATA, "No data record for name") |
---|
| 398 | |
---|
| 399 | #ifndef NO_RECOVERY |
---|
| 400 | #define NO_RECOVERY -1 |
---|
| 401 | #endif |
---|
| 402 | CND(NO_RECOVERY, "Non recoverable errors") |
---|
| 403 | _NL |
---|
| 404 | TXT(" -------------------") |
---|
| 405 | TXT(" -- Control flags --") |
---|
| 406 | TXT(" -------------------") |
---|
| 407 | _NL |
---|
| 408 | |
---|
| 409 | #ifndef FIONBIO |
---|
| 410 | #define FIONBIO -1 |
---|
| 411 | #endif |
---|
| 412 | CND(FIONBIO, "Set/clear non-blocking io") |
---|
| 413 | |
---|
| 414 | #ifndef FIONREAD |
---|
| 415 | #define FIONREAD -1 |
---|
| 416 | #endif |
---|
| 417 | CND(FIONREAD, "How many bytes to read") |
---|
| 418 | _NL |
---|
| 419 | TXT(" --------------------") |
---|
| 420 | TXT(" -- Shutdown modes --") |
---|
| 421 | TXT(" --------------------") |
---|
| 422 | _NL |
---|
| 423 | |
---|
| 424 | #ifndef SHUT_RD |
---|
| 425 | #define SHUT_RD -1 |
---|
| 426 | #endif |
---|
| 427 | CND(SHUT_RD, "No more recv") |
---|
| 428 | |
---|
| 429 | #ifndef SHUT_WR |
---|
| 430 | #define SHUT_WR -1 |
---|
| 431 | #endif |
---|
| 432 | CND(SHUT_WR, "No more send") |
---|
| 433 | |
---|
| 434 | #ifndef SHUT_RDWR |
---|
| 435 | #define SHUT_RDWR -1 |
---|
| 436 | #endif |
---|
| 437 | CND(SHUT_RDWR, "No more recv/send") |
---|
| 438 | _NL |
---|
| 439 | TXT(" ---------------------") |
---|
| 440 | TXT(" -- Protocol levels --") |
---|
| 441 | TXT(" ---------------------") |
---|
| 442 | _NL |
---|
| 443 | |
---|
| 444 | #ifndef SOL_SOCKET |
---|
| 445 | #define SOL_SOCKET -1 |
---|
| 446 | #endif |
---|
| 447 | CND(SOL_SOCKET, "Options for socket level") |
---|
| 448 | |
---|
| 449 | #ifndef IPPROTO_IP |
---|
| 450 | #define IPPROTO_IP -1 |
---|
| 451 | #endif |
---|
| 452 | CND(IPPROTO_IP, "Dummy protocol for IP") |
---|
| 453 | |
---|
| 454 | #ifndef IPPROTO_UDP |
---|
| 455 | #define IPPROTO_UDP -1 |
---|
| 456 | #endif |
---|
| 457 | CND(IPPROTO_UDP, "UDP") |
---|
| 458 | |
---|
| 459 | #ifndef IPPROTO_TCP |
---|
| 460 | #define IPPROTO_TCP -1 |
---|
| 461 | #endif |
---|
| 462 | CND(IPPROTO_TCP, "TCP") |
---|
| 463 | _NL |
---|
| 464 | TXT(" -------------------") |
---|
| 465 | TXT(" -- Request flags --") |
---|
| 466 | TXT(" -------------------") |
---|
| 467 | _NL |
---|
| 468 | |
---|
| 469 | #ifndef MSG_OOB |
---|
| 470 | #define MSG_OOB -1 |
---|
| 471 | #endif |
---|
| 472 | CND(MSG_OOB, "Process out-of-band data") |
---|
| 473 | |
---|
| 474 | #ifndef MSG_PEEK |
---|
| 475 | #define MSG_PEEK -1 |
---|
| 476 | #endif |
---|
| 477 | CND(MSG_PEEK, "Peek at incoming data") |
---|
| 478 | |
---|
| 479 | #ifndef MSG_EOR |
---|
| 480 | #define MSG_EOR -1 |
---|
| 481 | #endif |
---|
| 482 | CND(MSG_EOR, "Send end of record") |
---|
| 483 | |
---|
| 484 | #ifndef MSG_WAITALL |
---|
| 485 | #define MSG_WAITALL -1 |
---|
| 486 | #endif |
---|
| 487 | CND(MSG_WAITALL, "Wait for full reception") |
---|
| 488 | |
---|
| 489 | #ifndef MSG_NOSIGNAL |
---|
| 490 | #define MSG_NOSIGNAL -1 |
---|
| 491 | #endif |
---|
| 492 | CND(MSG_NOSIGNAL, "No SIGPIPE on send") |
---|
| 493 | |
---|
| 494 | #ifdef __linux__ |
---|
| 495 | # define MSG_Forced_Flags "MSG_NOSIGNAL" |
---|
| 496 | #else |
---|
| 497 | # define MSG_Forced_Flags "0" |
---|
| 498 | #endif |
---|
| 499 | CN_(MSG_Forced_Flags, "") |
---|
| 500 | TXT(" -- Flags set on all send(2) calls") |
---|
| 501 | |
---|
| 502 | _NL |
---|
| 503 | TXT(" --------------------") |
---|
| 504 | TXT(" -- Socket options --") |
---|
| 505 | TXT(" --------------------") |
---|
| 506 | _NL |
---|
| 507 | |
---|
| 508 | #ifndef TCP_NODELAY |
---|
| 509 | #define TCP_NODELAY -1 |
---|
| 510 | #endif |
---|
| 511 | CND(TCP_NODELAY, "Do not coalesce packets") |
---|
| 512 | |
---|
| 513 | #ifndef SO_REUSEADDR |
---|
| 514 | #define SO_REUSEADDR -1 |
---|
| 515 | #endif |
---|
| 516 | CND(SO_REUSEADDR, "Bind reuse local address") |
---|
| 517 | |
---|
[36fcd41] | 518 | #ifndef SO_REUSEPORT |
---|
| 519 | #define SO_REUSEPORT -1 |
---|
| 520 | #endif |
---|
| 521 | CND(SO_REUSEPORT, "Bind reuse port number") |
---|
| 522 | |
---|
[fd0047e] | 523 | #ifndef SO_KEEPALIVE |
---|
| 524 | #define SO_KEEPALIVE -1 |
---|
| 525 | #endif |
---|
| 526 | CND(SO_KEEPALIVE, "Enable keep-alive msgs") |
---|
| 527 | |
---|
| 528 | #ifndef SO_LINGER |
---|
| 529 | #define SO_LINGER -1 |
---|
| 530 | #endif |
---|
| 531 | CND(SO_LINGER, "Defer close to flush data") |
---|
| 532 | |
---|
| 533 | #ifndef SO_BROADCAST |
---|
| 534 | #define SO_BROADCAST -1 |
---|
| 535 | #endif |
---|
| 536 | CND(SO_BROADCAST, "Can send broadcast msgs") |
---|
| 537 | |
---|
| 538 | #ifndef SO_SNDBUF |
---|
| 539 | #define SO_SNDBUF -1 |
---|
| 540 | #endif |
---|
| 541 | CND(SO_SNDBUF, "Set/get send buffer size") |
---|
| 542 | |
---|
| 543 | #ifndef SO_RCVBUF |
---|
| 544 | #define SO_RCVBUF -1 |
---|
| 545 | #endif |
---|
| 546 | CND(SO_RCVBUF, "Set/get recv buffer size") |
---|
| 547 | |
---|
| 548 | #ifndef SO_SNDTIMEO |
---|
| 549 | #define SO_SNDTIMEO -1 |
---|
| 550 | #endif |
---|
| 551 | CND(SO_SNDTIMEO, "Emission timeout") |
---|
| 552 | |
---|
| 553 | #ifndef SO_RCVTIMEO |
---|
| 554 | #define SO_RCVTIMEO -1 |
---|
| 555 | #endif |
---|
| 556 | CND(SO_RCVTIMEO, "Reception timeout") |
---|
| 557 | |
---|
| 558 | #ifndef SO_ERROR |
---|
| 559 | #define SO_ERROR -1 |
---|
| 560 | #endif |
---|
| 561 | CND(SO_ERROR, "Get/clear error status") |
---|
| 562 | |
---|
| 563 | #ifndef IP_MULTICAST_IF |
---|
| 564 | #define IP_MULTICAST_IF -1 |
---|
| 565 | #endif |
---|
| 566 | CND(IP_MULTICAST_IF, "Set/get mcast interface") |
---|
| 567 | |
---|
| 568 | #ifndef IP_MULTICAST_TTL |
---|
| 569 | #define IP_MULTICAST_TTL -1 |
---|
| 570 | #endif |
---|
| 571 | CND(IP_MULTICAST_TTL, "Set/get multicast TTL") |
---|
| 572 | |
---|
| 573 | #ifndef IP_MULTICAST_LOOP |
---|
| 574 | #define IP_MULTICAST_LOOP -1 |
---|
| 575 | #endif |
---|
| 576 | CND(IP_MULTICAST_LOOP, "Set/get mcast loopback") |
---|
| 577 | |
---|
| 578 | #ifndef IP_ADD_MEMBERSHIP |
---|
| 579 | #define IP_ADD_MEMBERSHIP -1 |
---|
| 580 | #endif |
---|
| 581 | CND(IP_ADD_MEMBERSHIP, "Join a multicast group") |
---|
| 582 | |
---|
| 583 | #ifndef IP_DROP_MEMBERSHIP |
---|
| 584 | #define IP_DROP_MEMBERSHIP -1 |
---|
| 585 | #endif |
---|
| 586 | CND(IP_DROP_MEMBERSHIP, "Leave a multicast group") |
---|
| 587 | |
---|
[58ff82d] | 588 | #ifndef IP_PKTINFO |
---|
| 589 | #define IP_PKTINFO -1 |
---|
| 590 | #endif |
---|
| 591 | CND(IP_PKTINFO, "Get datagram info") |
---|
| 592 | |
---|
[fd0047e] | 593 | _NL |
---|
| 594 | TXT(" -------------------") |
---|
| 595 | TXT(" -- System limits --") |
---|
| 596 | TXT(" -------------------") |
---|
| 597 | _NL |
---|
| 598 | |
---|
| 599 | #ifndef IOV_MAX |
---|
| 600 | #define IOV_MAX INT_MAX |
---|
| 601 | #endif |
---|
| 602 | CND(IOV_MAX, "Maximum writev iovcnt") |
---|
| 603 | |
---|
| 604 | _NL |
---|
| 605 | TXT(" ----------------------") |
---|
| 606 | TXT(" -- Type definitions --") |
---|
| 607 | TXT(" ----------------------") |
---|
| 608 | _NL |
---|
| 609 | |
---|
| 610 | { |
---|
| 611 | struct timeval tv; |
---|
| 612 | TXT(" -- Sizes (in bytes) of the components of struct timeval") |
---|
| 613 | _NL |
---|
| 614 | #define SIZEOF_tv_sec (sizeof tv.tv_sec) |
---|
| 615 | CND(SIZEOF_tv_sec, "tv_sec") |
---|
| 616 | #define SIZEOF_tv_usec (sizeof tv.tv_usec) |
---|
| 617 | CND(SIZEOF_tv_usec, "tv_usec") |
---|
| 618 | } |
---|
[58ff82d] | 619 | _NL |
---|
| 620 | TXT(" -- Sizes of protocol specific address types (for sockaddr.sa_len)") |
---|
| 621 | _NL |
---|
| 622 | #define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in)) |
---|
| 623 | CND(SIZEOF_sockaddr_in, "struct sockaddr_in") |
---|
| 624 | #ifdef HAVE_AF_INET6 |
---|
| 625 | # define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6)) |
---|
| 626 | #else |
---|
| 627 | # define SIZEOF_sockaddr_in6 0 |
---|
| 628 | #endif |
---|
| 629 | CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6") |
---|
| 630 | _NL |
---|
| 631 | TXT(" -- Size of file descriptor sets") |
---|
| 632 | _NL |
---|
| 633 | #define SIZEOF_fd_set (sizeof (fd_set)) |
---|
| 634 | CND(SIZEOF_fd_set, "fd_set"); |
---|
| 635 | _NL |
---|
| 636 | TXT(" -- Fields of struct hostent") |
---|
| 637 | _NL |
---|
| 638 | #ifdef __MINGW32__ |
---|
| 639 | # define h_addrtype_t "short" |
---|
| 640 | # define h_length_t "short" |
---|
| 641 | #else |
---|
| 642 | # define h_addrtype_t "int" |
---|
| 643 | # define h_length_t "int" |
---|
| 644 | #endif |
---|
| 645 | TXT(" subtype H_Addrtype_T is Interfaces.C." h_addrtype_t ";") |
---|
| 646 | TXT(" subtype H_Length_T is Interfaces.C." h_length_t ";") |
---|
[36fcd41] | 647 | _NL |
---|
| 648 | TXT(" ----------------------------------------") |
---|
| 649 | TXT(" -- Properties of supported interfaces --") |
---|
| 650 | TXT(" ----------------------------------------") |
---|
| 651 | _NL |
---|
| 652 | |
---|
| 653 | CND(Need_Netdb_Buffer, "Need buffer for Netdb ops") |
---|
[58ff82d] | 654 | CND(Has_Sockaddr_Len, "Sockaddr has sa_len field") |
---|
| 655 | _NL |
---|
| 656 | TXT(" Thread_Blocking_IO : constant Boolean := True;") |
---|
| 657 | TXT(" -- Set False for contexts where socket i/o are process blocking") |
---|
[36fcd41] | 658 | |
---|
[fd0047e] | 659 | #ifdef __vxworks |
---|
| 660 | _NL |
---|
| 661 | TXT(" --------------------------------") |
---|
| 662 | TXT(" -- VxWorks-specific constants --") |
---|
| 663 | TXT(" --------------------------------") |
---|
| 664 | _NL |
---|
| 665 | TXT(" -- These constants may be used only within the VxWorks version of") |
---|
| 666 | TXT(" -- GNAT.Sockets.Thin.") |
---|
| 667 | _NL |
---|
| 668 | |
---|
| 669 | CND(OK, "VxWorks generic success") |
---|
| 670 | CND(ERROR, "VxWorks generic error") |
---|
| 671 | #endif |
---|
| 672 | |
---|
[36fcd41] | 673 | #ifdef __MINGW32__ |
---|
| 674 | _NL |
---|
| 675 | TXT(" ------------------------------") |
---|
| 676 | TXT(" -- MinGW-specific constants --") |
---|
| 677 | TXT(" ------------------------------") |
---|
| 678 | _NL |
---|
| 679 | TXT(" -- These constants may be used only within the MinGW version of") |
---|
| 680 | TXT(" -- GNAT.Sockets.Thin.") |
---|
| 681 | _NL |
---|
| 682 | |
---|
| 683 | CND(WSASYSNOTREADY, "System not ready") |
---|
| 684 | CND(WSAVERNOTSUPPORTED, "Version not supported") |
---|
[58ff82d] | 685 | CND(WSANOTINITIALISED, "Winsock not initialized") |
---|
[36fcd41] | 686 | CND(WSAEDISCON, "Disconnected") |
---|
| 687 | #endif |
---|
| 688 | |
---|
[fd0047e] | 689 | _NL |
---|
| 690 | TXT("end GNAT.Sockets.Constants;") |
---|
| 691 | |
---|
| 692 | output (); |
---|
| 693 | return 0; |
---|
| 694 | } |
---|
| 695 | |
---|
| 696 | void |
---|
| 697 | output (void) { |
---|
| 698 | int text_max = 0, value_max = 0, l; |
---|
| 699 | struct line *p; |
---|
| 700 | char fmt[64]; |
---|
| 701 | #define UPD_MAX(x) do { \ |
---|
| 702 | l = strlen (p->x); \ |
---|
| 703 | if (l > x ## _max) x ## _max = l; \ |
---|
| 704 | } while (0) |
---|
| 705 | |
---|
| 706 | for (p = first; p != NULL; p = p->next) { |
---|
| 707 | if (p->value != NULL) { |
---|
| 708 | UPD_MAX(text); |
---|
[58ff82d] | 709 | if (p->kind == NUM) |
---|
| 710 | UPD_MAX(value); |
---|
[fd0047e] | 711 | } |
---|
| 712 | } |
---|
| 713 | sprintf (fmt, " %%-%ds : constant := %%%ds;%%s%%s\n", |
---|
| 714 | text_max, value_max); |
---|
| 715 | |
---|
| 716 | for (p = first; p != NULL; p = p->next) { |
---|
| 717 | if (p->value == NULL) { |
---|
| 718 | printf ("%s\n", p->text); |
---|
| 719 | } else { |
---|
| 720 | char *comment_sep = (strlen (p->comment) > 0) |
---|
| 721 | ? " -- " : ""; |
---|
| 722 | printf (fmt, p->text, p->value, comment_sep, p->comment); |
---|
| 723 | } |
---|
| 724 | } |
---|
| 725 | } |
---|
| 726 | |
---|
| 727 | char * |
---|
| 728 | f_itoa (char *fmt, int n) { |
---|
| 729 | char buf[32], *ret; |
---|
| 730 | sprintf (buf, fmt, n); |
---|
| 731 | ret = malloc (strlen (buf) + 1); |
---|
| 732 | if (ret != NULL) |
---|
| 733 | strcpy (ret, buf); |
---|
| 734 | return ret; |
---|
| 735 | } |
---|
| 736 | |
---|
| 737 | void |
---|
[58ff82d] | 738 | add_line (char *_text, char *_value, char *_comment, kind_t _kind) { |
---|
[fd0047e] | 739 | struct line *l = (struct line *) malloc (sizeof (struct line)); |
---|
| 740 | |
---|
[58ff82d] | 741 | l->text = _text; |
---|
| 742 | l->value = _value; |
---|
[fd0047e] | 743 | l->comment = _comment; |
---|
[58ff82d] | 744 | l->kind = _kind; |
---|
| 745 | l->next = NULL; |
---|
| 746 | |
---|
[fd0047e] | 747 | if (last == NULL) |
---|
| 748 | first = last = l; |
---|
| 749 | else { |
---|
| 750 | last->next = l; |
---|
| 751 | last = l; |
---|
| 752 | } |
---|
| 753 | } |
---|