move static constants out of ip6.h.

This commit is contained in:
leitner
2001-02-05 17:50:19 +00:00
parent 4819776eb5
commit 0c36e167de
9 changed files with 78 additions and 11 deletions

15
socket/socket_bind4.c Normal file
View File

@@ -0,0 +1,15 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include "byte.h"
#include "uint16.h"
#include "uint32.h"
#include "socket.h"
int socket_bind4(int s,const char *ip,uint16 port) {
struct sockaddr_in si;
byte_zero(&si,sizeof si);
si.sin_family = AF_INET;
uint16_pack_big((char*) &si.sin_port,port);
*(uint32*)&si.sin_addr = *(uint32*)ip;
return bind(s,(struct sockaddr*)&si,sizeof si);
}