Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

sokintrf.c File Reference

#include "rcs_defs.hh"
#include "sokintrf.h"
#include "rcs_prnt.hh"
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

Include dependency graph for sokintrf.c:

Include dependency graph

Go to the source code of this file.

Defines

#define MAKEWORD(a, b)   ((unsigned short) (((unsigned char) (a)) | ((unsigned short) ((unsigned char) (b)) << 8)))

Enumerations

enum  SOCKET_AVAILABILITY { SOCKET_AVAIL_NOT_CHECKED, SOCKETS_AVAILABLE, SOCKETS_NOT_AVAILABLE }

Functions

int RCS_EXPORT load_socket_interface ()
void RCS_EXPORT unload_socket_interface ()
int dl_fd_isset (SOCKET s, fd_set RCS_FAR *set)
int dl_accept (SOCKET s, struct sockaddr *name, int *plen)
int RCS_EXPORT dl_bind (SOCKET s, struct sockaddr *name, int port)
int RCS_EXPORT dl_closesocket (SOCKET s)
int RCS_EXPORT dl_ioctlsocket (SOCKET s, long cmd, unsigned long *argp)
unsigned long RCS_EXPORT dl_htonl (unsigned long hostlong)
unsigned long RCS_EXPORT dl_ntohl (unsigned long netlong)
unsigned short RCS_EXPORT dl_htons (unsigned short hostshort)
unsigned short RCS_EXPORT dl_ntohs (unsigned short netshort)
unsigned long RCS_EXPORT dl_inet_addr (char *addr_string)
char RCS_EXPORT * dl_inet_ntoa (struct in_addr in)
int RCS_EXPORT dl_inet_netof (struct in_addr addr)
int RCS_EXPORT dl_gethostname (char *hostname, int maxlen)
in_addr dl_inet_makeaddr (const int net, const int lna)
int RCS_EXPORT dl_listen (SOCKET s, int backlog)
int RCS_EXPORT dl_recv (SOCKET s, char *buf, int size, int flags)
int RCS_EXPORT dl_send (SOCKET s, char *buf, int size, int flags)
int RCS_EXPORT dl_recvfrom (SOCKET s, char *buf, int size, int flags, struct sockaddr *from, int *namelen)
int RCS_EXPORT dl_sendto (SOCKET s, char *buf, int size, int flags, struct sockaddr *to, int namelen)
int RCS_EXPORT dl_select (int maxfd, fd_set *read_fds, fd_set *write_fds, fd_set *except_fds, struct timeval RCS_FAR *timeout)
SOCKET RCS_EXPORT dl_socket (int domain, int type, int protocol)
int RCS_EXPORT dl_connect (SOCKET s, struct sockaddr *name, int namelen)
int RCS_EXPORT dl_gethostbyname (char *hostname, struct hostent **hpp)
int RCS_EXPORT dl_setsockopt (SOCKET s, int level, int opt, char RCS_FAR *optval, int len)

Variables

int WSA_count = 0
enum SOCKET_AVAILABILITY socket_availability = SOCKET_AVAIL_NOT_CHECKED


Define Documentation

#define MAKEWORD a,
     ((unsigned short) (((unsigned char) (a)) | ((unsigned short) ((unsigned char) (b)) << 8)))
 

Definition at line 12 of file sokintrf.c.

Referenced by load_socket_interface().


Enumeration Type Documentation

enum SOCKET_AVAILABILITY
 

Enumeration values:
SOCKET_AVAIL_NOT_CHECKED 
SOCKETS_AVAILABLE 
SOCKETS_NOT_AVAILABLE 

Definition at line 100 of file sokintrf.c.


Function Documentation

int RCS_EXPORT load_socket_interface  
 

Definition at line 254 of file sokintrf.c.

Referenced by CMS_SERVER_REMOTE_UDP_PORT::CMS_SERVER_REMOTE_UDP_PORT(), STCPMEM::STCPMEM(), TCPMEM::TCPMEM(), TCPSVR_BLOCKING_READ_REQUEST::TCPSVR_BLOCKING_READ_REQUEST(), UDPMEM::UDPMEM(), and CMS::setup_diag_proc_info().

00255 {
00256 #if !defined(_WINDOWS)
00257   socket_availability = SOCKETS_AVAILABLE;
00258   return 0;
00259 #else
00260   short winsock_version;
00261   int wsa_startup_retval;
00262   WSADATA startup_data;
00263 
00264   if (SOCKETS_NOT_AVAILABLE == socket_availability)
00265     {
00266       return -1;
00267     }
00268   if (SOCKETS_AVAILABLE == socket_availability)
00269     {
00270       return 0;
00271     }
00272   socket_availability = SOCKETS_NOT_AVAILABLE;
00273 
00274 #if defined(USE_DYNAMICALLY_LOADED_POINTERS)
00275 #if defined(WIN32)
00276   socket_library_instance = LoadLibrary ("wsock32.dll");
00277   if (socket_library_instance == NULL)
00278     {
00279       rcs_print_error ("Error on LoadLibrary(" "wsock32.dll" ")\n");
00280       return -1;
00281     }
00282 #else
00283   socket_library_instance = (void RCS_FAR *) LoadLibrary ("winsock.dll");
00284   if (((int) socket_library_instance) < HINSTANCE_ERROR)
00285     {
00286       rcs_print_error ("Error %d from LoadLibrary(" "winsock.dll" ")\n",
00287                        socket_library_instance);
00288       return -1;
00289     }
00290 #endif
00291   ptr_to_wsastartup = (PTR_TO_WSASTARTUP) GetProc ("WSAStartup");
00292   if (NULL == ptr_to_wsastartup)
00293     {
00294       rcs_print_error ("Cannot find WSAStartup function.\n");
00295       return -1;
00296     }
00297   ptr_to_wsacleanup = (PTR_TO_WSACLEANUP) GetProc ("WSACleanup");
00298   if (NULL == ptr_to_wsacleanup)
00299     {
00300       rcs_print_error ("Cannot find WSACleanup function.\n");
00301       return -1;
00302     }
00303   ptr_to_wsagetlasterror = (PTR_TO_WSAGETLASTERROR)
00304     GetProc ("WSAGetLastError");
00305   if (NULL == ptr_to_wsagetlasterror)
00306     {
00307       rcs_print_error ("Cannot find WSAGetLastError function.\n");
00308       return -1;
00309     }
00310   ptr_to_wsaisfdset = (PTR_TO_WSAISFDSET) GetProc ("__WSAFDIsSet");
00311   if (NULL == ptr_to_wsaisfdset)
00312     {
00313       rcs_print_error ("Cannot find WSAGetLastError function.\n");
00314       return -1;
00315     }
00316   ptr_to_socket = (PTR_TO_SOCKET) GetProc ("socket");
00317   if (NULL == ptr_to_socket)
00318     {
00319       rcs_print_error ("Cannot find socket function.\n");
00320       return -1;
00321     }
00322   ptr_to_closesocket = (PTR_TO_CLOSESOCKET) GetProc ("closesocket");
00323   if (NULL == ptr_to_closesocket)
00324     {
00325       rcs_print_error ("Cannot find closesocket function.\n");
00326       return -1;
00327     }
00328   ptr_to_bind = (PTR_TO_BIND) GetProc ("bind");
00329   if (NULL == ptr_to_bind)
00330     {
00331       rcs_print_error ("Cannot find bind function.\n");
00332       return -1;
00333     }
00334   ptr_to_connect = (PTR_TO_CONNECT) GetProc ("connect");
00335   if (NULL == ptr_to_connect)
00336     {
00337       rcs_print_error ("Cannot find connect function.\n");
00338       return -1;
00339     }
00340   ptr_to_accept = (PTR_TO_ACCEPT) GetProc ("accept");
00341   if (NULL == ptr_to_accept)
00342     {
00343       rcs_print_error ("Cannot find accept function.\n");
00344       return -1;
00345     }
00346   ptr_to_listen = (PTR_TO_LISTEN) GetProc ("listen");
00347   if (NULL == ptr_to_listen)
00348     {
00349       rcs_print_error ("Cannot find listen function.\n");
00350       return -1;
00351     }
00352   ptr_to_select = (PTR_TO_SELECT) GetProc ("select");
00353   if (NULL == ptr_to_select)
00354     {
00355       rcs_print_error ("Cannot find select function.\n");
00356       return -1;
00357     }
00358   ptr_to_send = (PTR_TO_SEND) GetProc ("send");
00359   if (NULL == ptr_to_send)
00360     {
00361       rcs_print_error ("Cannot find send function.\n");
00362       return -1;
00363     }
00364   ptr_to_recv = (PTR_TO_RECV) GetProc ("recv");
00365   if (NULL == ptr_to_recv)
00366     {
00367       rcs_print_error ("Cannot find recv function.\n");
00368       return -1;
00369     }
00370   ptr_to_sendto = (PTR_TO_SENDTO) GetProc ("sendto");
00371   if (NULL == ptr_to_sendto)
00372     {
00373       rcs_print_error ("Cannot find sendto function.\n");
00374       return -1;
00375     }
00376   ptr_to_recvfrom = (PTR_TO_RECVFROM) GetProc ("recvfrom");
00377   if (NULL == ptr_to_recvfrom)
00378     {
00379       rcs_print_error ("Cannot find recvfrom function.\n");
00380       return -1;
00381     }
00382   ptr_to_inet_addr = (PTR_TO_INET_ADDR) GetProc ("inet_addr");
00383   if (NULL == ptr_to_inet_addr)
00384     {
00385       rcs_print_error ("Cannot find inet_addr function.\n");
00386       return -1;
00387     }
00388   ptr_to_inet_ntoa = (PTR_TO_INET_NTOA) GetProc ("inet_ntoa");
00389   if (NULL == ptr_to_inet_ntoa)
00390     {
00391       rcs_print_error ("Cannot find inet_ntoa function.\n");
00392       return -1;
00393     }
00394 
00395   ptr_to_htonl = (PTR_TO_HTONL) GetProc ("htonl");
00396   if (NULL == ptr_to_htonl)
00397     {
00398       rcs_print_error ("Cannot find htonl function.\n");
00399       return -1;
00400     }
00401   ptr_to_htons = (PTR_TO_HTONS) GetProc ("htons");
00402   if (NULL == ptr_to_htons)
00403     {
00404       rcs_print_error ("Cannot find htons function.\n");
00405       return -1;
00406     }
00407   ptr_to_ntohl = (PTR_TO_NTOHL) GetProc ("ntohl");
00408   if (NULL == ptr_to_ntohl)
00409     {
00410       rcs_print_error ("Cannot find ntohl function.\n");
00411       return -1;
00412     }
00413   ptr_to_ntohs = (PTR_TO_NTOHS) GetProc ("ntohs");
00414   if (NULL == ptr_to_ntohs)
00415     {
00416       rcs_print_error ("Cannot find ntohs function.\n");
00417       return -1;
00418     }
00419   ptr_to_setsockopt = (PTR_TO_SETSOCKOPT) GetProc ("setsockopt");
00420   if (NULL == ptr_to_setsockopt)
00421     {
00422       rcs_print_error ("Cannot find setsockopt function.\n");
00423       return -1;
00424     }
00425   ptr_to_ioctlsocket = (PTR_TO_IOCTLSOCKET) GetProc ("ioctlsocket");
00426   if (NULL == ptr_to_ioctlsocket)
00427     {
00428       rcs_print_error ("Cannot find ioctlsocket function.\n");
00429       return -1;
00430     }
00431   ptr_to_gethostbyname = (PTR_TO_GETHOSTBYNAME) GetProc ("gethostbyname");
00432   if (NULL == ptr_to_gethostbyname)
00433     {
00434       rcs_print_error ("Cannot find gethostbyname function.\n");
00435       return -1;
00436     }
00437 
00438   winsock_version = MAKEWORD (2, 0);
00439   wsa_startup_retval = (*ptr_to_wsastartup) (winsock_version, &startup_data);
00440   if (wsa_startup_retval)
00441     {
00442       rcs_print_error ("Error %d from WSAStartup.\n", wsa_startup_retval);
00443       return -1;
00444     }
00445   socket_availability = SOCKETS_AVAILABLE;
00446 #else /* USE_DYNAMICALLY_LOADED_POINTERS */
00447 #ifdef USE_WINSOCK
00448   winsock_version = MAKEWORD (2, 0);
00449   wsa_startup_retval = WSAStartup (winsock_version, &startup_data);
00450   if (wsa_startup_retval)
00451     {
00452       rcs_print_error ("Error %d from WSAStartup.\n", wsa_startup_retval);
00453       return -1;
00454     }
00455   socket_availability = SOCKETS_AVAILABLE;
00456   return 0;
00457 #endif
00458 #endif /* USE_DYNAMICALLY_LOADED_POINTERS */
00459 
00460 #endif
00461 }

void RCS_EXPORT unload_socket_interface  
 

Definition at line 464 of file sokintrf.c.

Referenced by STCPMEM::~STCPMEM(), TCPMEM::~TCPMEM(), and UDPMEM::~UDPMEM().

00465 {
00466 #ifdef USE_DYNAMICALLY_LOADED_POINTERS
00467   if (SOCKETS_AVAILABLE == socket_availability
00468       && NULL != ptr_to_wsacleanup && socket_library_instance != NULL)
00469     {
00470       (*ptr_to_wsacleanup) ();
00471       FreeLibrary (socket_library_instance);
00472     }
00473   socket_library_instance = NULL;
00474   ptr_to_wsastartup = NULL;
00475   ptr_to_wsagetlasterror = NULL;
00476   ptr_to_wsacleanup = NULL;
00477 #endif /* USE_DYNAMICALLY_LOADED_POINTERS */
00478   socket_availability = SOCKET_AVAIL_NOT_CHECKED;
00479 
00480 }

int dl_fd_isset SOCKET    s,
fd_set RCS_FAR *    set
 

Definition at line 505 of file sokintrf.c.

00506 {
00507 #if !defined(_WINDOWS) || !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00508   return ((int) FD_ISSET (s, set));
00509 #else
00510   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_wsaisfdset)
00511     {
00512       rcs_print_error ("Can not call __WSAFDIsSet.\n");
00513       return 0;
00514     }
00515   return (*ptr_to_wsaisfdset) (s, set);
00516 #endif
00517 }

int dl_accept SOCKET    s,
struct sockaddr   name,
int *    plen
 

Definition at line 521 of file sokintrf.c.

00522 {
00523 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00524   return accept (s, name, plen);
00525 #else
00526   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_accept)
00527     {
00528       rcs_print_error ("Cannot call accept ().\n");
00529       return -1;
00530     }
00531   return (*ptr_to_accept) (s, name, plen);
00532 #endif
00533 }

int RCS_EXPORT dl_bind SOCKET    s,
struct sockaddr   name,
int    port
 

Definition at line 537 of file sokintrf.c.

00538 {
00539 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00540   return bind (s, name, port);
00541 #else
00542   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_bind)
00543     {
00544       rcs_print_error ("Cannot call bind ().\n");
00545       return -1;
00546     }
00547   return (*ptr_to_bind) (s, name, port);
00548 #endif
00549 }

int RCS_EXPORT dl_closesocket SOCKET    s
 

Definition at line 552 of file sokintrf.c.

00553 {
00554 #ifndef USE_WINSOCK
00555   return close (s);
00556 #else
00557 #ifdef USE_DYNAMICALLY_LOADED_POINTERS
00558   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_closesocket)
00559     {
00560       rcs_print_error ("Cannot call closesocket ().\n");
00561       return -1;
00562     }
00563   return (*ptr_to_closesocket) (s);
00564 #else
00565   return closesocket (s);
00566 #endif
00567 #endif
00568 }

int RCS_EXPORT dl_ioctlsocket SOCKET    s,
long    cmd,
unsigned long *    argp
 

Definition at line 571 of file sokintrf.c.

00572 {
00573 #ifndef USE_WINSOCK
00574 #ifndef VXWORKS
00575 #if defined(MSDOS) && !defined(_Windows)
00576   return tk_ioctl (s, (int) cmd, (int *) argp);
00577 #else
00578   return ioctl (s, (int) cmd, (caddr_t) argp);
00579 #endif
00580 #else
00581   return ioctl (s, (int) cmd, (int) argp);
00582 #endif
00583 #else
00584 #ifdef USE_DYNAMICALLY_LOADED_POINTERS
00585   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_ioctlsocket)
00586     {
00587       rcs_print_error ("Cannot call ioctlsocket ().\n");
00588       return -1;
00589     }
00590   return (*ptr_to_ioctlsocket) (s, cmd, argp);
00591 #else
00592   return ioctlsocket (s, cmd, argp);
00593 #endif
00594 #endif
00595 }

unsigned long RCS_EXPORT dl_htonl unsigned long    hostlong
 

Definition at line 598 of file sokintrf.c.

00599 {
00600 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00601   return htonl (hostlong);
00602 #else
00603   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_htonl)
00604     {
00605       rcs_print_error ("Cannot call htonl ().\n");
00606       return hostlong;
00607     }
00608   return (*ptr_to_htonl) (hostlong);
00609 #endif
00610 }

unsigned long RCS_EXPORT dl_ntohl unsigned long    netlong
 

Definition at line 613 of file sokintrf.c.

00614 {
00615 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00616   return ntohl (netlong);
00617 #else
00618   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_ntohl)
00619     {
00620       rcs_print_error ("Cannot call ntohl ().\n");
00621       return netlong;
00622     }
00623   return (*ptr_to_ntohl) (netlong);
00624 #endif
00625 }

unsigned short RCS_EXPORT dl_htons unsigned short    hostshort
 

Definition at line 628 of file sokintrf.c.

00629 {
00630 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00631   return htons (hostshort);
00632 #else
00633   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_htons)
00634     {
00635       rcs_print_error ("Cannot call htons ().\n");
00636       return hostshort;
00637     }
00638   return (*ptr_to_htons) (hostshort);
00639 #endif
00640 }

unsigned short RCS_EXPORT dl_ntohs unsigned short    netshort
 

Definition at line 644 of file sokintrf.c.

00645 {
00646 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00647   return ntohs (netshort);
00648 #else
00649   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_ntohs)
00650     {
00651       rcs_print_error ("Cannot call ntohs ().\n");
00652       return netshort;
00653     }
00654   return (*ptr_to_ntohs) (netshort);
00655 #endif
00656 }

unsigned long RCS_EXPORT dl_inet_addr char *    addr_string
 

Definition at line 659 of file sokintrf.c.

00660 {
00661 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00662   return inet_addr (addr_string);
00663 #else
00664   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_inet_addr)
00665     {
00666       rcs_print_error ("Cannot call inet_addr ().\n");
00667       return 0;
00668     }
00669   return (*ptr_to_inet_addr) (addr_string);
00670 #endif
00671 }

char RCS_EXPORT* dl_inet_ntoa struct in_addr    in
 

Definition at line 674 of file sokintrf.c.

00675 {
00676 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00677   return (char *) inet_ntoa (in);
00678 #else
00679   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_inet_ntoa)
00680     {
00681       rcs_print_error ("Cannot call inet_ntoa ().\n");
00682       return NULL;
00683     }
00684   return (*ptr_to_inet_ntoa) (in);
00685 #endif
00686 }

int RCS_EXPORT dl_inet_netof struct in_addr    addr
 

Definition at line 689 of file sokintrf.c.

00690 {
00691 #ifdef WINDOWS
00692   return addr.S_un.S_addr & 0xffffff00;
00693 #else
00694   return inet_netof (addr);
00695 #endif
00696 }

int RCS_EXPORT dl_gethostname char *    hostname,
int    maxlen
 

Definition at line 699 of file sokintrf.c.

00700 {
00701   return gethostname (hostname, maxlen);
00702 }

struct in_addr dl_inet_makeaddr const int    net,
const int    lna
 

Definition at line 705 of file sokintrf.c.

00706 {
00707 #ifdef WINDOWS
00708   struct in_addr tempAddress;
00709   tempAddress.S_un.S_addr = ((u_long) net) | ((u_long) lna);
00710   return tempAddress;
00711 #else
00712   return (struct in_addr) inet_makeaddr (net, lna);
00713 #endif
00714 }

int RCS_EXPORT dl_listen SOCKET    s,
int    backlog
 

Definition at line 717 of file sokintrf.c.

00718 {
00719 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00720   return listen (s, backlog);
00721 #else
00722   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_listen)
00723     {
00724       rcs_print_error ("Cannot call listen ().\n");
00725       return -1;
00726     }
00727   return (*ptr_to_listen) (s, backlog);
00728 #endif
00729 }

int RCS_EXPORT dl_recv SOCKET    s,
char *    buf,
int    size,
int    flags
 

Definition at line 732 of file sokintrf.c.

00733 {
00734 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00735   return recv (s, buf, size, flags);
00736 #else
00737   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_recv)
00738     {
00739       rcs_print_error ("Cannot call recv ().\n");
00740       return -1;
00741     }
00742   return (*ptr_to_recv) (s, buf, size, flags);
00743 #endif
00744 }

int RCS_EXPORT dl_send SOCKET    s,
char *    buf,
int    size,
int    flags
 

Definition at line 747 of file sokintrf.c.

00748 {
00749 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00750   return send (s, buf, size, flags);
00751 #else
00752   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_send)
00753     {
00754       rcs_print_error ("Cannot call recv ().\n");
00755       return -1;
00756     }
00757   return (*ptr_to_send) (s, buf, size, flags);
00758 #endif
00759 }

int RCS_EXPORT dl_recvfrom SOCKET    s,
char *    buf,
int    size,
int    flags,
struct sockaddr   from,
int *    namelen
 

Definition at line 762 of file sokintrf.c.

00764 {
00765 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00766   return recvfrom (s, buf, size, flags, from, namelen);
00767 #else
00768   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_recvfrom)
00769     {
00770       rcs_print_error ("Cannot call recvfrom ().\n");
00771       return -1;
00772     }
00773   return (*ptr_to_recvfrom) (s, buf, size, flags, from, namelen);
00774 #endif
00775 }

int RCS_EXPORT dl_sendto SOCKET    s,
char *    buf,
int    size,
int    flags,
struct sockaddr   to,
int    namelen
 

Definition at line 778 of file sokintrf.c.

00780 {
00781 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00782   return sendto (s, buf, size, flags, to, namelen);
00783 #else
00784   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_sendto)
00785     {
00786       rcs_print_error ("Cannot call sendto ().\n");
00787       return -1;
00788     }
00789   return (*ptr_to_sendto) (s, buf, size, flags, to, namelen);
00790 #endif
00791 }

int RCS_EXPORT dl_select int    maxfd,
fd_set *    read_fds,
fd_set *    write_fds,
fd_set *    except_fds,
struct timeval RCS_FAR *    timeout
 

Definition at line 794 of file sokintrf.c.

00796 {
00797 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00798 #ifdef MSDOS
00799   struct timeval far *temp = timeout;
00800   return select (maxfd, read_fds, write_fds, except_fds,
00801                  ((struct timeval far *) temp));
00802 #else
00803   return select (maxfd, read_fds, write_fds, except_fds, timeout);
00804 #endif
00805 #else
00806   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_select)
00807     {
00808       rcs_print_error ("Cannot call select ().\n");
00809       return -1;
00810     }
00811   return (*ptr_to_select) (maxfd, read_fds, write_fds, except_fds, timeout);
00812 #endif
00813 }

SOCKET RCS_EXPORT dl_socket int    domain,
int    type,
int    protocol
 

Definition at line 816 of file sokintrf.c.

00817 {
00818 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00819   return socket (domain, type, protocol);
00820 #else
00821   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_socket)
00822     {
00823       rcs_print_error ("Cannot call socket ().\n");
00824       return -1;
00825     }
00826   return (*ptr_to_socket) (domain, type, protocol);
00827 #endif
00828 }

int RCS_EXPORT dl_connect SOCKET    s,
struct sockaddr   name,
int    namelen
 

Definition at line 831 of file sokintrf.c.

00832 {
00833 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00834   return connect (s, name, namelen);
00835 #else
00836   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_connect)
00837     {
00838       rcs_print_error ("Cannot call connect ().\n");
00839       return -1;
00840     }
00841   return (*ptr_to_connect) (s, name, namelen);
00842 #endif
00843 }

int RCS_EXPORT dl_gethostbyname char *    hostname,
struct hostent **    hpp
 

Definition at line 847 of file sokintrf.c.

00848 {
00849 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00850 #ifdef VXWORKS
00851   rcs_print_error
00852     ("VxWorks programs must use hostGetByName() rather than dl_gethostbyname().");
00853   return NULL;
00854 #else
00855   *hpp = (struct hostent *) gethostbyname (hostname);
00856   return 0;
00857 #endif
00858 #else
00859   if (socket_availability != SOCKETS_AVAILABLE
00860       || NULL == ptr_to_gethostbyname)
00861     {
00862       rcs_print_error ("Cannot call gethostbyname ().\n");
00863       return -1;
00864     }
00865   *hpp = (*ptr_to_gethostbyname) (hostname);
00866   return 0;
00867 #endif
00868 }

int RCS_EXPORT dl_setsockopt SOCKET    s,
int    level,
int    opt,
char RCS_FAR *    optval,
int    len
 

Definition at line 872 of file sokintrf.c.

00873 {
00874 #if !defined(USE_DYNAMICALLY_LOADED_POINTERS)
00875   return setsockopt (s, level, opt, optval, len);
00876 #else
00877   if (socket_availability != SOCKETS_AVAILABLE || NULL == ptr_to_setsockopt)
00878     {
00879       rcs_print_error ("Cannot call setsockopt().\n");
00880       return -1;
00881     }
00882   return (*ptr_to_setsockopt) (s, level, opt, optval, len);
00883 #endif
00884 }


Variable Documentation

int WSA_count = 0
 

Definition at line 16 of file sokintrf.c.

enum SOCKET_AVAILABILITY socket_availability = SOCKET_AVAIL_NOT_CHECKED
 

Definition at line 106 of file sokintrf.c.


Generated on Sun Dec 2 15:57:56 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001