#include <stdio.h>
#include <stdlib.h>
#include <winsock2.h>
#include "osiSock.h"
#include "errlog.h"
#include "epicsVersion.h"
Go to the source code of this file.
LIBCOM_API int epicsStdCall epicsSocketAccept |
( |
int |
sock, |
|
|
struct sockaddr * |
pAddr, |
|
|
osiSocklen_t * |
addrlen |
|
) |
| |
Definition at line 122 of file osdSock.c.
125 return accept ( sock, pAddr, addrlen );
LIBCOM_API SOCKET epicsStdCall epicsSocketCreate |
( |
int |
domain, |
|
|
int |
type, |
|
|
int |
protocol |
|
) |
| |
Definition at line 116 of file osdSock.c.
119 return socket ( domain,
type, protocol );
pvd::StructureConstPtr type
LIBCOM_API void epicsStdCall epicsSocketDestroy |
( |
SOCKET |
s | ) |
|
Definition at line 128 of file osdSock.c.
130 int status = closesocket ( s );
135 "epicsSocketDestroy: failed to " 136 "close a socket because \"%s\"\n", buf );
void epicsSocketConvertErrnoToString(char *pBuf, unsigned bufSize)
int errlogPrintf(const char *pFormat,...)
LIBCOM_API int epicsStdCall hostToIPAddr |
( |
const char * |
pHostName, |
|
|
struct in_addr * |
pIPA |
|
) |
| |
Definition at line 165 of file osdSock.c.
169 phe = gethostbyname (pHostName);
170 if (phe && phe->h_addr_list[0]) {
171 if (phe->h_addrtype==AF_INET && phe->h_length<=
sizeof(
struct in_addr)) {
172 struct in_addr *pInAddrIn = (
struct in_addr *) phe->h_addr_list[0];
LIBCOM_API unsigned epicsStdCall ipAddrToHostName |
( |
const struct in_addr * |
pAddr, |
|
|
char * |
pBuf, |
|
|
unsigned |
bufSize |
|
) |
| |
Definition at line 144 of file osdSock.c.
152 ent = gethostbyaddr((
char *) pAddr,
sizeof (*pAddr), AF_INET);
154 strncpy (pBuf, ent->h_name, bufSize);
155 pBuf[bufSize-1] =
'\0';
156 return strlen (pBuf);
LIBCOM_API int epicsStdCall osiSockAttach |
( |
void |
| ) |
|
Definition at line 49 of file osdSock.c.
63 DWORD titleLength = GetConsoleTitle(title,
sizeof(title));
65 titleLength = strlen (title);
66 strncat (title,
" " EPICS_VERSION_STRING,
sizeof(title));
69 strncpy(title, EPICS_VERSION_STRING,
sizeof(title));
71 title[
sizeof(title)-1]=
'\0';
72 SetConsoleTitle(title);
73 freopen(
"CONOUT$",
"a",
stderr );
80 status = WSAStartup(MAKEWORD(2,2), &WsaData);
83 "Unable to attach to windows sockets version 2. error=%d\n", status);
85 "A Windows Sockets II update for windows 95 is available at\n");
87 "http://www.microsoft.com/windows95/info/ws2.htm");
91 # if defined ( _DEBUG ) && 0 92 fprintf(
stderr,
"EPICS attached to winsock version %s\n", WsaData.szDescription);
LIBCOM_API void epicsStdCall osiSockRelease |
( |
void |
| ) |
|
Definition at line 103 of file osdSock.c.
106 if (--nAttached==0u) {
108 # if defined ( _DEBUG ) && 0 109 fprintf(
stderr,
"EPICS released winsock version %s\n", WsaData.szDescription);
111 memset (&WsaData,
'\0',
sizeof(WsaData));
LIBCOM_API unsigned epicsStdCall wsaMajorVersion |
( |
| ) |
|
Definition at line 41 of file osdSock.c.
43 return (
unsigned) LOBYTE( WsaData.wVersion );