#include <rpc_host.hh>
Collaboration diagram for RPC_HOST:
Public Methods | |
RPC_HOST (char *host_name) | |
virtual | ~RPC_HOST () |
int | check_if_prog_registered (unsigned long) |
Data Fields | |
char RCS_FAR * | name |
sockaddr_in RCS_FAR * | socket_address |
hostent RCS_FAR * | host_entry |
pmaplist RCS_FAR * | pmap_entry |
|
Definition at line 50 of file rpc_host.cc. 00051 { 00052 name = NULL; 00053 socket_address = NULL; 00054 #ifndef VXWORKS 00055 host_entry = NULL; 00056 #endif 00057 name = (char *) malloc (strlen (host_name) + 1); 00058 if (NULL != name) 00059 { 00060 strcpy (name, host_name); 00061 } 00062 else 00063 { 00064 rcs_print_error ("RPC_HOST: Couldn't malloc space for name.\n"); 00065 return; 00066 } 00067 00068 #ifndef VXWORKS 00069 host_entry = gethostbyname (name); 00070 if (NULL == host_entry) 00071 { 00072 rcs_print_error ("RPC_HOST: Error from gethostbyname. \n"); 00073 return; 00074 } 00075 socket_address = new sockaddr_in; 00076 if (NULL != socket_address) 00077 { 00078 #ifdef __MSDOS__ 00079 socket_address->sin_addr.s_addr = 00080 *((u_long *) host_entry->h_addr_list[0]); 00081 #else 00082 socket_address->sin_addr.s_addr = *((int *) host_entry->h_addr_list[0]); 00083 #endif 00084 socket_address->sin_family = host_entry->h_addrtype; 00085 } 00086 #else 00087 rpcTaskInit (); 00088 socket_address = new sockaddr_in; 00089 if (NULL != socket_address) 00090 { 00091 socket_address->sin_addr.s_addr = hostGetByName (name); 00092 if (socket_address->sin_addr.s_addr == ERROR) 00093 { 00094 rcs_print_error ("RPC_HOST: Couldn't get host address for (%s).\n", 00095 name); 00096 delete socket_address; 00097 socket_address = NULL; 00098 return; 00099 } 00100 socket_address->sin_family = AF_INET; 00101 } 00102 #endif 00103 } |
|
Definition at line 106 of file rpc_host.cc. |
|
Definition at line 121 of file rpc_host.cc. 00122 { 00123 if (NULL == socket_address) 00124 { 00125 return -1; 00126 } 00127 #ifdef MSDOS 00128 pmap_entry = (pmaplist RCS_FAR *) pmap_getmaps ( 00129 ((sockaddr_in far *) 00130 socket_address)); 00131 #else 00132 pmap_entry = (pmaplist RCS_FAR *) pmap_getmaps (socket_address); 00133 #endif 00134 if (NULL == pmap_entry) 00135 { 00136 return (-1); 00137 } 00138 int retval = 0; 00139 while (NULL != pmap_entry) 00140 { 00141 pmaplist *next_entry; 00142 if (pmap_entry->pml_map.pm_prog == prog && 00143 pmap_entry->pml_map.pm_prot == IPPROTO_TCP) 00144 { 00145 retval = 1; 00146 } 00147 next_entry = pmap_entry->pml_next; 00148 delete pmap_entry; 00149 pmap_entry = next_entry; 00150 } 00151 return retval; 00152 } |
|
Definition at line 58 of file rpc_host.hh. |
|
Definition at line 59 of file rpc_host.hh. |
|
Definition at line 61 of file rpc_host.hh. |
|
Definition at line 63 of file rpc_host.hh. |