ucspi-ssl  0.99e
TLS encryption for IPv6 communication
socket_accept.c
Go to the documentation of this file.
1 #include <sys/types.h>
2 #include <sys/param.h>
3 #include <sys/socket.h>
4 #include <netinet/in.h>
5 #include "byte.h"
6 #include "socket.h"
7 
8 int socket_accept4(int s,char ip[4],uint16 *port)
9 {
10  struct sockaddr_in sa;
11  socklen_t dummy = sizeof sa;
12  int fd;
13 
14  fd = accept(s,(struct sockaddr *) &sa,&dummy);
15  if (fd == -1) return -1;
16 
17  byte_copy(ip,4,(char *) &sa.sin_addr);
18  uint16_unpack_big((char *) &sa.sin_port,port);
19 
20  return fd;
21 }
void byte_copy(void *, unsigned int, const void *)
int socket_accept4(int s, char ip[4], uint16 *port)
Definition: socket_accept.c:8
unsigned short uint16
Definition: uint16.h:4
void uint16_unpack_big(const char *, uint16 *)