aboutsummaryrefslogtreecommitdiff
path: root/src/libip
diff options
context:
space:
mode:
Diffstat (limited to 'src/libip')
-rw-r--r--src/libip/bo.c33
-rw-r--r--src/libip/ip.h77
2 files changed, 33 insertions, 77 deletions
diff --git a/src/libip/bo.c b/src/libip/bo.c
index 54675d8c..95fc5f8d 100644
--- a/src/libip/bo.c
+++ b/src/libip/bo.c
@@ -2,6 +2,21 @@
#include <libc.h>
#include <ip.h>
+void
+hnputv(void *p, uvlong v)
+{
+ uchar *a;
+
+ a = p;
+ a[0] = v>>56;
+ a[1] = v>>48;
+ a[2] = v>>40;
+ a[3] = v>>32;
+ a[4] = v>>24;
+ a[5] = v>>16;
+ a[6] = v>>8;
+ a[7] = v;
+}
void
hnputl(void *p, uint v)
@@ -25,6 +40,24 @@ hnputs(void *p, ushort v)
a[1] = v;
}
+uvlong
+nhgetv(void *p)
+{
+ uchar *a;
+ uvlong v;
+
+ a = p;
+ v = (uvlong)a[0]<<56;
+ v |= (uvlong)a[1]<<48;
+ v |= (uvlong)a[2]<<40;
+ v |= (uvlong)a[3]<<32;
+ v |= a[4]<<24;
+ v |= a[5]<<16;
+ v |= a[6]<<8;
+ v |= a[7]<<0;
+ return v;
+}
+
uint
nhgetl(void *p)
{
diff --git a/src/libip/ip.h b/src/libip/ip.h
deleted file mode 100644
index aae565c0..00000000
--- a/src/libip/ip.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#pragma src "/sys/src/libip"
-#pragma lib "libip.a"
-
-enum
-{
- IPaddrlen= 16,
- IPv4addrlen= 4,
- IPv4off= 12,
- IPllen= 4,
-};
-
-/*
- * for reading /net/ipifc
- */
-typedef struct Ipifc Ipifc;
-typedef struct Ipifcs Ipifcs;
-
-struct Ipifc
-{
- char dev[64];
- uchar ip[IPaddrlen];
- uchar mask[IPaddrlen];
- uchar net[IPaddrlen]; /* ip & mask */
- Ipifc *next;
-};
-
-struct Ipifcs
-{
- Ipifc *first;
- Ipifc *last;
-};
-
-/*
- * user level udp headers
- */
-enum
-{
- Udphdrsize= 36, /* size of a Udphdr */
-};
-
-typedef struct Udphdr Udphdr;
-struct Udphdr
-{
- uchar raddr[IPaddrlen]; /* remote address and port */
- uchar laddr[IPaddrlen]; /* local address and port */
- uchar rport[2];
- uchar lport[2];
-};
-
-uchar* defmask(uchar*);
-void maskip(uchar*, uchar*, uchar*);
-int eipconv(va_list*, Fconv*);
-ulong parseip(uchar*, char*);
-ulong parseipmask(uchar*, char*);
-int parseether(uchar*, char*);
-int myipaddr(uchar*, char*);
-int myetheraddr(uchar*, char*);
-
-void readipifc(char*, Ipifcs*);
-
-void hnputl(void*, uint);
-void hnputs(void*, ushort);
-uint nhgetl(void*);
-ushort nhgets(void*);
-
-#define ipcmp(x, y) memcmp(x, y, IPaddrlen)
-#define ipmove(x, y) memmove(x, y, IPaddrlen)
-
-extern uchar IPv4bcast[IPaddrlen];
-extern uchar IPv4bcastobs[IPaddrlen];
-extern uchar IPv4allsys[IPaddrlen];
-extern uchar IPv4allrouter[IPaddrlen];
-extern uchar IPnoaddr[IPaddrlen];
-extern uchar v4prefix[IPaddrlen];
-extern uchar IPallbits[IPaddrlen];
-
-#define CLASS(p) ((*(uchar*)(p))>>6)