--- sa.c 2004/06/26 11:38:20 1.85
+++ sa.c 2004/10/03 14:00:23 1.86
@@ -210,13 +210,14 @@
/* system call table */
typedef struct {
- SA_SC_DECLARE_3(int, connect, int, const struct sockaddr *, socklen_t)
- SA_SC_DECLARE_3(int, accept, int, struct sockaddr *, socklen_t *)
- SA_SC_DECLARE_5(int, select, int, fd_set *, fd_set *, fd_set *, struct timeval *)
- SA_SC_DECLARE_3(ssize_t, read, int, void *, size_t)
- SA_SC_DECLARE_3(ssize_t, write, int, const void *, size_t)
- SA_SC_DECLARE_6(ssize_t, recvfrom, int, void *, size_t, int, struct sockaddr *, socklen_t *)
- SA_SC_DECLARE_6(ssize_t, sendto, int, const void *, size_t, int, const struct sockaddr *, socklen_t)
+ SA_SC_DECLARE_3(int, connect, int, const struct sockaddr *, socklen_t)
+ SA_SC_DECLARE_3(int, accept, int, struct sockaddr *, socklen_t *)
+ SA_SC_DECLARE_5(int, select, int, fd_set *, fd_set *, fd_set *, struct timeval *)
+ SA_SC_DECLARE_3(ssize_t, read, int, void *, size_t)
+ SA_SC_DECLARE_3(ssize_t, write, int, const void *, size_t)
+ SA_SC_DECLARE_6(ssize_t, recvfrom, int, void *, size_t, int, struct sockaddr *, socklen_t *)
+ SA_SC_DECLARE_6(ssize_t, sendto, int, const void *, size_t, int, const struct sockaddr *, socklen_t)
+ SA_SC_DECLARE_1(struct hostent *, gethostbyname, const char *name)
} sa_syscall_tab_t;
/* socket option information */
@@ -497,8 +498,8 @@
struct servent *se;
int bIPv6;
int bNumeric;
- char *cpHost;
- char *cpPort;
+ const char *cpHost;
+ const char *cpPort;
char *cpProto;
unsigned int nPort;
const char *cpPath;
@@ -559,7 +560,7 @@
}
else if (strncmp(uri, "inet://", 7) == 0) {
/* parse URI into host, port and protocol parts */
- cpHost = (char *)(uri+7);
+ cpHost = uri+7;
bIPv6 = FALSE;
if (cpHost[0] == '[') {
/* IPv6 address (see RFC2732) */
@@ -652,7 +653,7 @@
sf = AF_INET6;
}
#endif
- else if ((he = gethostbyname(cpHost)) != NULL) {
+ else if ((he = SA_SC_CALL_1(sa, gethostbyname, cpHost)) != NULL) {
if (he->h_addrtype == AF_INET) {
sa4.sin_family = AF_INET;
sa4.sin_port = htons(nPort);
@@ -1175,13 +1176,14 @@
}
/* init syscall object attributes */
- SA_SC_ASSIGN(sa, connect, connect, NULL);
- SA_SC_ASSIGN(sa, accept, accept, NULL);
- SA_SC_ASSIGN(sa, select, select, NULL);
- SA_SC_ASSIGN(sa, read, read, NULL);
- SA_SC_ASSIGN(sa, write, write, NULL);
- SA_SC_ASSIGN(sa, recvfrom, recvfrom, NULL);
- SA_SC_ASSIGN(sa, sendto, sendto, NULL);
+ SA_SC_ASSIGN(sa, connect, connect, NULL);
+ SA_SC_ASSIGN(sa, accept, accept, NULL);
+ SA_SC_ASSIGN(sa, select, select, NULL);
+ SA_SC_ASSIGN(sa, read, read, NULL);
+ SA_SC_ASSIGN(sa, write, write, NULL);
+ SA_SC_ASSIGN(sa, recvfrom, recvfrom, NULL);
+ SA_SC_ASSIGN(sa, sendto, sendto, NULL);
+ SA_SC_ASSIGN(sa, gethostbyname, gethostbyname, NULL);
/* pass object to caller */
*sap = sa;
@@ -1404,13 +1406,14 @@
/* assign system call */
rv = SA_OK;
switch (id) {
- case SA_SYSCALL_CONNECT: SA_SC_ASSIGN(sa, connect, fptr, fctx); break;
- case SA_SYSCALL_ACCEPT: SA_SC_ASSIGN(sa, accept, fptr, fctx); break;
- case SA_SYSCALL_SELECT: SA_SC_ASSIGN(sa, select, fptr, fctx); break;
- case SA_SYSCALL_READ: SA_SC_ASSIGN(sa, read, fptr, fctx); break;
- case SA_SYSCALL_WRITE: SA_SC_ASSIGN(sa, write, fptr, fctx); break;
- case SA_SYSCALL_RECVFROM: SA_SC_ASSIGN(sa, recvfrom, fptr, fctx); break;
- case SA_SYSCALL_SENDTO: SA_SC_ASSIGN(sa, sendto, fptr, fctx); break;
+ case SA_SYSCALL_CONNECT: SA_SC_ASSIGN(sa, connect, fptr, fctx); break;
+ case SA_SYSCALL_ACCEPT: SA_SC_ASSIGN(sa, accept, fptr, fctx); break;
+ case SA_SYSCALL_SELECT: SA_SC_ASSIGN(sa, select, fptr, fctx); break;
+ case SA_SYSCALL_READ: SA_SC_ASSIGN(sa, read, fptr, fctx); break;
+ case SA_SYSCALL_WRITE: SA_SC_ASSIGN(sa, write, fptr, fctx); break;
+ case SA_SYSCALL_RECVFROM: SA_SC_ASSIGN(sa, recvfrom, fptr, fctx); break;
+ case SA_SYSCALL_SENDTO: SA_SC_ASSIGN(sa, sendto, fptr, fctx); break;
+ case SA_SYSCALL_GETHOSTBYNAME: SA_SC_ASSIGN(sa, gethostbyname, fptr, fctx); break;
default: rv = SA_ERR_ARG;
}
@@ -1650,6 +1653,7 @@
SA_SC_COPY((*csa), sa, write);
SA_SC_COPY((*csa), sa, recvfrom);
SA_SC_COPY((*csa), sa, sendto);
+ SA_SC_COPY((*csa), sa, gethostbyname);
/* copy-over original timeout values */
for (i = 0; i < (int)(sizeof(sa->tvTimeout)/sizeof(sa->tvTimeout[0])); i++) {
|