summaryrefslogtreecommitdiff
path: root/libc/inet
diff options
context:
space:
mode:
Diffstat (limited to 'libc/inet')
-rw-r--r--libc/inet/getnetbyad.c5
-rw-r--r--libc/inet/resolv.c45
-rw-r--r--libc/inet/rpc/bindresvport.c2
-rw-r--r--libc/inet/rpc/svc.c2
-rw-r--r--libc/inet/socketcalls.c22
5 files changed, 67 insertions, 9 deletions
diff --git a/libc/inet/getnetbyad.c b/libc/inet/getnetbyad.c
index f1c2328f2..38fe03cc6 100644
--- a/libc/inet/getnetbyad.c
+++ b/libc/inet/getnetbyad.c
@@ -19,10 +19,7 @@
extern int _net_stayopen;
-struct netent *
-getnetbyaddr(net, type)
- register long net;
- register int type;
+struct netent *getnetbyaddr (uint32_t net, int type)
{
register struct netent *p;
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 034bb80db..e5558fbde 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -50,7 +50,6 @@
#include <arpa/inet.h>
#include <stdlib.h>
#include <unistd.h>
-#include <cfgfile.h>
#include <resolv.h>
#include <netdb.h>
#include <ctype.h>
@@ -72,6 +71,31 @@
#endif /* DEBUG */
+struct resolv_header {
+ int id;
+ int qr,opcode,aa,tc,rd,ra,rcode;
+ int qdcount;
+ int ancount;
+ int nscount;
+ int arcount;
+};
+
+struct resolv_question {
+ char * dotted;
+ int qtype;
+ int qclass;
+};
+
+struct resolv_answer {
+ char * dotted;
+ int atype;
+ int aclass;
+ int ttl;
+ int rdlength;
+ unsigned char * rdata;
+ int rdoffset;
+};
+
extern int nameservers;
extern char * nameserver[MAX_SERVERS];
extern int searchdomains;
@@ -86,6 +110,22 @@ extern int resolve_mailbox(const char * address, int nscount,
extern int dns_lookup(const char * name, int type, int nscount,
char ** nsip, unsigned char ** outpacket, struct resolv_answer * a);
+int encode_dotted(const char * dotted, unsigned char * dest, int maxlen);
+int decode_dotted(const unsigned char * message, int offset,
+ char * dest, int maxlen);
+int length_dotted(const unsigned char * message, int offset);
+int encode_header(struct resolv_header * h, unsigned char * dest, int maxlen);
+int decode_header(unsigned char * data, struct resolv_header * h);
+int encode_question(struct resolv_question * q,
+ unsigned char * dest, int maxlen);
+int decode_question(unsigned char * message, int offset,
+ struct resolv_question * q);
+int encode_answer(struct resolv_answer * a,
+ unsigned char * dest, int maxlen);
+int decode_answer(unsigned char * message, int offset,
+ struct resolv_answer * a);
+int length_question(unsigned char * message, int offset);
+extern int open_nameservers(void);
#ifdef L_encodeh
@@ -1141,8 +1181,7 @@ int res_query(const char *dname, int class, int type,
#ifdef L_gethostbyaddr
-
-struct hostent *gethostbyaddr(const char *addr, int len, int type)
+struct hostent *gethostbyaddr (const void *addr, __socklen_t len, int type)
{
static struct hostent h;
static char namebuf[256];
diff --git a/libc/inet/rpc/bindresvport.c b/libc/inet/rpc/bindresvport.c
index e71dff7f4..800398ae4 100644
--- a/libc/inet/rpc/bindresvport.c
+++ b/libc/inet/rpc/bindresvport.c
@@ -75,7 +75,7 @@ struct sockaddr_in *sin;
if (port > ENDPORT) {
port = STARTPORT;
}
- res = bind(sd, sin, sizeof(struct sockaddr_in));
+ res = bind(sd, (struct sockaddr *)sin, (socklen_t)sizeof(struct sockaddr_in));
}
return (res);
}
diff --git a/libc/inet/rpc/svc.c b/libc/inet/rpc/svc.c
index 0436e3042..780a33725 100644
--- a/libc/inet/rpc/svc.c
+++ b/libc/inet/rpc/svc.c
@@ -40,11 +40,13 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
+#define __USE_XOPEN
#include <sys/errno.h>
#include <rpc/rpc.h>
#include <rpc/pmap_clnt.h>
#ifdef __linux__
#include <sys/types.h>
+#include <sys/select.h>
#endif
extern int errno;
diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c
index 7b968cdb6..f73eeb0ec 100644
--- a/libc/inet/socketcalls.c
+++ b/libc/inet/socketcalls.c
@@ -3,10 +3,30 @@
#include <errno.h>
#include <syscall.h>
#include <sys/socket.h>
-#include <sys/socketcall.h>
+
extern int socketcall(int call, unsigned long *args);
+/* Various socketcall numbers */
+#define SYS_SOCKET 1
+#define SYS_BIND 2
+#define SYS_CONNECT 3
+#define SYS_LISTEN 4
+#define SYS_ACCEPT 5
+#define SYS_GETSOCKNAME 6
+#define SYS_GETPEERNAME 7
+#define SYS_SOCKETPAIR 8
+#define SYS_SEND 9
+#define SYS_RECV 10
+#define SYS_SENDTO 11
+#define SYS_RECVFROM 12
+#define SYS_SHUTDOWN 13
+#define SYS_SETSOCKOPT 14
+#define SYS_GETSOCKOPT 15
+#define SYS_SENDMSG 16
+#define SYS_RECVMSG 17
+
+
#ifdef L_accept
int accept(int s, struct sockaddr *addr, socklen_t * addrlen)
{