move static constants out of ip6.h.
This commit is contained in:
15
socket/socket_bind4.c
Normal file
15
socket/socket_bind4.c
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user