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