| 1 |
/*************************************************************************\ |
| 2 |
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne |
| 3 |
* National Laboratory. |
| 4 |
* Copyright (c) 2002 The Regents of the University of California, as |
| 5 |
* Operator of Los Alamos National Laboratory. |
| 6 |
* EPICS BASE is distributed subject to a Software License Agreement found |
| 7 |
* in file LICENSE that is included with this distribution. |
| 8 |
\*************************************************************************/ |
| 9 |
|
| 10 |
/* |
| 11 |
* Linux specific socket include |
| 12 |
*/ |
| 13 |
|
| 14 |
#ifndef osdSockH |
| 15 |
#define osdSockH |
| 16 |
|
| 17 |
#include <sys/errno.h> |
| 18 |
|
| 19 |
#include <sys/types.h> |
| 20 |
#include <sys/param.h> /* for MAXHOSTNAMELEN */ |
| 21 |
#include <sys/time.h> |
| 22 |
#include <sys/socket.h> |
| 23 |
#include <sys/ioctl.h> |
| 24 |
#include <netinet/in.h> |
| 25 |
#include <netinet/tcp.h> |
| 26 |
#include <arpa/inet.h> |
| 27 |
#include <net/if.h> |
| 28 |
#include <netdb.h> |
| 29 |
#include <unistd.h> /* close() and others */ |
| 30 |
|
| 31 |
typedef int SOCKET; |
| 32 |
#define INVALID_SOCKET (-1) |
| 33 |
#define SOCKERRNO errno |
| 34 |
#define socket_ioctl(A,B,C) ioctl(A,B,C) |
| 35 |
typedef int osiSockIoctl_t; |
| 36 |
typedef socklen_t osiSocklen_t; |
| 37 |
typedef char osiSockOptMcastLoop_t; |
| 38 |
typedef char osiSockOptMcastTTL_t; |
| 39 |
|
| 40 |
#define FD_IN_FDSET(FD) ((FD)<FD_SETSIZE) |
| 41 |
|
| 42 |
#define SOCK_EWOULDBLOCK EWOULDBLOCK |
| 43 |
#define SOCK_ENOBUFS ENOBUFS |
| 44 |
#define SOCK_ECONNRESET ECONNRESET |
| 45 |
#define SOCK_ETIMEDOUT ETIMEDOUT |
| 46 |
#define SOCK_EACCES EACCES |
| 47 |
#define SOCK_EADDRINUSE EADDRINUSE |
| 48 |
#define SOCK_EADDRNOTAVAIL EADDRNOTAVAIL |
| 49 |
#define SOCK_ECONNREFUSED ECONNREFUSED |
| 50 |
#define SOCK_ECONNABORTED ECONNABORTED |
| 51 |
#define SOCK_EINPROGRESS EINPROGRESS |
| 52 |
#define SOCK_EISCONN EISCONN |
| 53 |
#define SOCK_EALREADY EALREADY |
| 54 |
#define SOCK_EINVAL EINVAL |
| 55 |
#define SOCK_EINTR EINTR |
| 56 |
#define SOCK_EPIPE EPIPE |
| 57 |
#define SOCK_EMFILE EMFILE |
| 58 |
#define SOCK_SHUTDOWN ESHUTDOWN |
| 59 |
#define SOCK_ENOTSOCK ENOTSOCK |
| 60 |
#define SOCK_EBADF EBADF |
| 61 |
#define SOCK_EMSGSIZE EMSGSIZE |
| 62 |
|
| 63 |
#ifndef SHUT_RD |
| 64 |
# define SHUT_RD 0 |
| 65 |
#endif |
| 66 |
|
| 67 |
#ifndef SHUT_WR |
| 68 |
# define SHUT_WR 1 |
| 69 |
#endif |
| 70 |
|
| 71 |
#ifndef SHUT_RDWR |
| 72 |
# define SHUT_RDWR 2 |
| 73 |
#endif |
| 74 |
|
| 75 |
#define ifreq_size(pifreq) (pifreq->ifr_addr.sa_len + sizeof(pifreq->ifr_name)) |
| 76 |
|
| 77 |
#ifndef IPPORT_USERRESERVED |
| 78 |
#define IPPORT_USERRESERVED 5000 |
| 79 |
#endif |
| 80 |
|
| 81 |
#endif /*osdSockH*/ |