ucspi-ssl  0.99e
TLS encryption for IPv6 communication
socket_local.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_local4(int s,char ip[4],uint16 *port)
9 {
10  struct sockaddr_in sa;
11  socklen_t dummy = sizeof sa;
12 
13  if (getsockname(s,(struct sockaddr *) &sa,&dummy) == -1) return -1;
14  byte_copy(ip,4,(char *) &sa.sin_addr);
15  uint16_unpack_big((char *) &sa.sin_port,port);
16  return 0;
17 }
void byte_copy(void *, unsigned int, const void *)
int socket_local4(int s, char ip[4], uint16 *port)
Definition: socket_local.c:8
unsigned short uint16
Definition: uint16.h:4
void uint16_unpack_big(const char *, uint16 *)