EPICS Base  7.0.7.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
osiSock.h
Go to the documentation of this file.
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 
20 /* Author: joh 1997-07-01 */
21 
22 #ifndef osiSockh
23 #define osiSockh
24 
25 #include "libComAPI.h"
26 #include "osdSock.h"
27 #include "ellLib.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 struct sockaddr;
34 struct sockaddr_in;
35 struct in_addr;
36 
47 LIBCOM_API SOCKET epicsStdCall epicsSocketCreate (
48  int domain, int type, int protocol );
49 
66 LIBCOM_API int epicsStdCall epicsSocketAccept (
67  int sock, struct sockaddr * pAddr, osiSocklen_t * addrlen );
73 LIBCOM_API void epicsStdCall epicsSocketDestroy (
74  SOCKET );
91 LIBCOM_API void epicsStdCall
109 LIBCOM_API void epicsStdCall
111 
124 
127 
130 };
131 
143 
144 #ifdef EPICS_PRIVATE_API
145 
155 LIBCOM_API int epicsSocketUnsentCount(SOCKET sock);
156 #endif
157 
175 LIBCOM_API unsigned epicsStdCall sockAddrToA (
176  const struct sockaddr * paddr, char * pBuf, unsigned bufSize );
177 
192 LIBCOM_API unsigned epicsStdCall ipAddrToA (
193  const struct sockaddr_in * pInetAddr, char * pBuf, unsigned bufSize );
194 
209 LIBCOM_API unsigned epicsStdCall sockAddrToDottedIP (
210  const struct sockaddr * paddr, char * pBuf, unsigned bufSize );
211 
225 LIBCOM_API unsigned epicsStdCall ipAddrToDottedIP (
226  const struct sockaddr_in * paddr, char * pBuf, unsigned bufSize );
227 
240 LIBCOM_API unsigned epicsStdCall ipAddrToHostName (
241  const struct in_addr * pAddr, char * pBuf, unsigned bufSize );
242 
257 LIBCOM_API int epicsStdCall aToIPAddr
258  ( const char * pAddrString, unsigned short defaultPort, struct sockaddr_in * pIP);
259 
269 LIBCOM_API int epicsStdCall hostToIPAddr
270  (const char *pHostName, struct in_addr *pIPA);
279 LIBCOM_API int epicsStdCall osiSockAttach (void); /* returns T if success, else F */
280 
288 LIBCOM_API void epicsStdCall osiSockRelease (void);
289 
300 LIBCOM_API void epicsSocketConvertErrorToString (
301  char * pBuf, unsigned bufSize, int error );
302 
313 LIBCOM_API void epicsSocketConvertErrnoToString (
314  char * pBuf, unsigned bufSize );
315 
323 typedef union osiSockAddr {
324  struct sockaddr_in ia;
325  struct sockaddr sa;
326 } osiSockAddr;
327 
333 typedef struct osiSockAddrNode {
334  ELLNODE node;
335  osiSockAddr addr;
337 
345 LIBCOM_API int epicsStdCall sockAddrAreIdentical
346  ( const osiSockAddr * plhs, const osiSockAddr * prhs );
347 
393 LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses
394  (ELLLIST *pList, SOCKET socket, const osiSockAddr *pMatchAddr);
395 
410 LIBCOM_API osiSockAddr epicsStdCall osiLocalAddr (SOCKET socket);
411 
412 #ifdef __cplusplus
413 }
414 #endif
415 
416 #endif /* ifndef osiSockh */
LIBCOM_API void epicsStdCall epicsSocketEnableAddressUseForDatagramFanout(SOCKET s)
Allows multiple sockets to use the same family, local address, and local port.
LIBCOM_API void epicsSocketConvertErrorToString(char *pBuf, unsigned bufSize, int error)
convert socket error numbers to a string
LIBCOM_API unsigned epicsStdCall ipAddrToA(const struct sockaddr_in *pInetAddr, char *pBuf, unsigned bufSize)
Convert IP address to ASCII.
List node type.
Definition: ellLib.h:46
Union to switch between sockaddr_in and sockaddr.
Definition: osiSock.h:323
LIBCOM_API int epicsStdCall sockAddrAreIdentical(const osiSockAddr *plhs, const osiSockAddr *prhs)
Compares two osiSockAddrs.
LIBCOM_API unsigned epicsStdCall ipAddrToDottedIP(const struct sockaddr_in *paddr, char *pBuf, unsigned bufSize)
Convert to raw dotted IP address with trailing port.
LIBCOM_API enum epicsSocketSystemCallInterruptMechanismQueryInfo epicsSocketSystemCallInterruptMechanismQuery()
Query what approach to use to interrupt blocking socket calls.
Calling close() required to interrupt.
Definition: osiSock.h:123
LIBCOM_API void epicsSocketConvertErrnoToString(char *pBuf, unsigned bufSize)
Convert the currently set errno to a string.
A doubly-linked list library.
List header type.
Definition: ellLib.h:57
calling shutdown() for both read and write required to interrupt
Definition: osiSock.h:126
epicsSocketSystemCallInterruptMechanismQueryInfo
Enum specifying how to interrupt a blocking socket system call.
Definition: osiSock.h:121
LIBCOM_API void epicsStdCall osiSockRelease(void)
release BSD socket library
LIBCOM_API int epicsStdCall osiSockAttach(void)
attach to BSD socket library
NO LONGER USED/SUPPORTED.
Definition: osiSock.h:129
LIBCOM_API void epicsStdCall epicsSocketDestroy(SOCKET)
Close and free resources held by a SOCKET object.
LIBCOM_API void epicsStdCall epicsSocketEnableAddressReuseDuringTimeWaitState(SOCKET s)
Allows a socket to bind ignoring other sockets in TIME_WAIT state.
LIBCOM_API void epicsStdCall osiSockDiscoverBroadcastAddresses(ELLLIST *pList, SOCKET socket, const osiSockAddr *pMatchAddr)
Add available broadcast addresses to a list.
LIBCOM_API osiSockAddr epicsStdCall osiLocalAddr(SOCKET socket)
LIBCOM_API unsigned epicsStdCall sockAddrToDottedIP(const struct sockaddr *paddr, char *pBuf, unsigned bufSize)
Convert to raw dotted IP address with trailing port.
LIBCOM_API unsigned epicsStdCall sockAddrToA(const struct sockaddr *paddr, char *pBuf, unsigned bufSize)
Convert socket address to ASCII.
LIBCOM_API int epicsStdCall epicsSocketAccept(int sock, struct sockaddr *pAddr, osiSocklen_t *addrlen)
Accept a connection on a listening stream socket.
LIBCOM_API int epicsStdCall aToIPAddr(const char *pAddrString, unsigned short defaultPort, struct sockaddr_in *pIP)
Attempt to convert ASCII string to an IP address.
LIBCOM_API int epicsStdCall hostToIPAddr(const char *pHostName, struct in_addr *pIPA)
Attempt to convert ASCII host name string with optional port to an IP address.
LIBCOM_API unsigned epicsStdCall ipAddrToHostName(const struct in_addr *pAddr, char *pBuf, unsigned bufSize)
Convert inet address to a host name string.
LIBCOM_API SOCKET epicsStdCall epicsSocketCreate(int domain, int type, int protocol)
Create a socket object.
Stores a list of socket addresses.
Definition: osiSock.h:333