serval-dna/nacl/nacl-20110221/curvecp/socket_bind.c
Daniel O'Connor bf9710fd5a Unpacked nacl-20110221 after processing by nacl-prepare-sources.
This only affects build_android, if nacl-gcc-prep is run then build/`uname -s` will be created.
2012-02-27 12:40:14 +10:30

16 lines
379 B
C

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include "socket.h"
#include "byte.h"
int socket_bind(int fd,const unsigned char *ip,const unsigned char *port)
{
struct sockaddr_in sa;
byte_zero(&sa,sizeof sa);
byte_copy(&sa.sin_addr,4,ip);
byte_copy(&sa.sin_port,2,port);
return bind(fd,(struct sockaddr *) &sa,sizeof sa);
}