/* mzsocket: BSD/POSIX sockets library for PLT-scheme * constants * * (C) Copyright 2007,2008 Dimitris Vyzovitis * * mzsocket is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * mzsocket is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with mzsocket. If not, see . */ #include "_socket.h" Scheme_Object *scheme_reload (Scheme_Env *env) { Scheme_Env *module; module = scheme_primitive_module (SYMBOL ("_constants"), env); EXPORT_CONST (SHUT_RD); EXPORT_CONST (SHUT_WR); EXPORT_CONST (SHUT_RDWR); EXPORT_CONST (IPPROTO_IP); EXPORT_CONST (IPPROTO_TCP); EXPORT_CONST (IPPROTO_UDP); EXPORT_CONST (IPPROTO_ICMP); EXPORT_CONST (AF_UNSPEC); EXPORT_CONST (PF_UNSPEC); EXPORT_CONST (AF_INET); EXPORT_CONST (PF_INET); EXPORT_CONST (SOL_SOCKET); EXPORT_CONST (SOCK_STREAM); EXPORT_CONST (SOCK_DGRAM); #ifdef HAVE_RAW EXPORT_VAL (SOCKET_HAVE_RAW, scheme_true); EXPORT_CONST (IPPROTO_RAW); EXPORT_CONST (SOCK_RAW); #else EXPORT_VAL (SOCKET_HAVE_RAW, scheme_false); #endif #ifdef HAVE_IPV6 EXPORT_VAL (SOCKET_HAVE_IPV6, scheme_true); EXPORT_CONST (IPPROTO_IPV6); EXPORT_CONST (AF_INET6); EXPORT_CONST (PF_INET6); #else EXPORT_VAL (SOCKET_HAVE_IPV6, scheme_false); EXPORT_VAL (AF_INET6, scheme_void); EXPORT_VAL (PF_INET6, scheme_void); #endif #ifdef UNIX EXPORT_VAL (SOCKET_HAVE_UNIX, scheme_true); EXPORT_CONST (AF_UNIX); EXPORT_CONST (PF_UNIX); #else EXPORT_VAL (SOCKET_HAVE_UNIX, scheme_false); EXPORT_VAL (AF_UNIX, scheme_void); EXPORT_VAL (PF_UNIX, scheme_void); #endif // sockopts #include "sockopt.export" // errno EXPORT_CONST (EACCES); EXPORT_CONST (EAFNOSUPPORT); EXPORT_CONST (EPFNOSUPPORT); EXPORT_CONST (EPROTONOSUPPORT); EXPORT_CONST (ENOBUFS); EXPORT_CONST (EFAULT); EXPORT_CONST (EADDRINUSE); EXPORT_CONST (EINVAL); EXPORT_CONST (ENOTSOCK); EXPORT_CONST (EOPNOTSUPP); EXPORT_CONST (EWOULDBLOCK); EXPORT_CONST (ECONNABORTED); EXPORT_CONST (EMFILE); EXPORT_CONST (ETIMEDOUT); EXPORT_CONST (ESOCKTNOSUPPORT); EXPORT_CONST (EALREADY); EXPORT_CONST (ECONNREFUSED); EXPORT_CONST (EISCONN); EXPORT_CONST (ENETUNREACH); EXPORT_CONST (ECONNRESET); EXPORT_CONST (EDESTADDRREQ); EXPORT_CONST (EMSGSIZE); EXPORT_CONST (ENOTCONN); EXPORT_CONST (EPROTOTYPE); EXPORT_CONST (ENOPROTOOPT); // this really should be impossile EXPORT_CONST (EINPROGRESS); // suppressed in connectct EXPORT_CONST (EADDRNOTAVAIL); EXPORT_CONST (ENETDOWN); EXPORT_CONST (ENETRESET); EXPORT_CONST (ESHUTDOWN); // unlikely EXPORT_CONST (EHOSTDOWN); EXPORT_CONST (EHOSTUNREACH); EXPORT_CONST (ENOMEM); // WSA_NOT_ENOUGH_MEMORY EXPORT_CONST (ENFILE); EXPORT_CONST (EBADF); EXPORT_CONST (EPIPE); EXPORT_VAL (INADDR_ANY, IMMUTABLE_BYTES("0.0.0.0")); EXPORT_VAL (INADDR_LOOPBACK, IMMUTABLE_BYTES("127.0.0.1")); EXPORT_VAL (INADDR_BROADCAST, IMMUTABLE_BYTES("255.255.255.255")); #ifdef HAVE_IPV6 EXPORT_VAL (IN6ADDR_ANY, IMMUTABLE_BYTES("::")); EXPORT_VAL (IN6ADDR_LOOPBACK, IMMUTABLE_BYTES( "::1" )); #endif scheme_finish_primitive_module (module); return scheme_void; } Scheme_Object *scheme_initialize (Scheme_Env *env) { return scheme_reload (env); } Scheme_Object *scheme_module_name() { return SYMBOL("_constants"); }