ReactOS 0.4.15-dev-8235-gcd88a97
getrpcport.c File Reference
#include <wintirpc.h>
#include <sys/types.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <rpc/rpc.h>
#include <rpc/pmap_clnt.h>
Include dependency graph for getrpcport.c:

Go to the source code of this file.


int getrpcport (char *host, int prognum, int versnum, int proto)

Function Documentation

◆ getrpcport()

int getrpcport ( char host,
int  prognum,
int  versnum,
int  proto 

Definition at line 47 of file getrpcport.c.

51 struct sockaddr_in addr;
52 struct hostent *hp;
54 assert(host != NULL);
56 if ((hp = gethostbyname(host)) == NULL)
57 return (0);
58 memset(&addr, 0, sizeof(addr));
59 addr.sin_family = AF_INET;
60 addr.sin_port = 0;
61 if (hp->h_length > sizeof(addr))
62 hp->h_length = sizeof(addr);
63 memcpy(&addr.sin_addr.s_addr, hp->h_addr, (size_t)hp->h_length);
64 /* Inconsistent interfaces need casts! :-( */
65 return (pmap_getport(&addr, (u_long)prognum, (u_long)versnum,
66 (u_int)proto));
UINT32 u_int
Definition: types.h:82
#define NULL
Definition: types.h:112
#define assert(x)
Definition: debug.h:53
unsigned long u_long
Definition: linux.h:269
#define AF_INET
Definition: tcpip.h:117
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
Definition: getxbyxx.c:221
GLenum const GLvoid * addr
Definition: glext.h:9621
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
u_short pmap_getport(struct sockaddr_in *address, u_long program, u_long version, u_int protocol)
Definition: pmap_getport.c:74
#define memset(x, y, z)
Definition: compat.h:39
short h_length
Definition: winsock.h:137
char * host
Definition: whois.c:55