47,11 → 47,14 |
#include "../include/in.h" |
#include "../include/in6.h" |
#include "../include/inet.h" |
#include "../include/ip_interface.h" |
#include "../include/socket_codes.h" |
#include "../include/socket_errno.h" |
|
#include "tl_common.h" |
|
DEVICE_MAP_IMPLEMENT( packet_dimensions, packet_dimension_t ); |
|
int tl_get_address_port( const struct sockaddr * addr, int addrlen, uint16_t * port ){ |
const struct sockaddr_in * address_in; |
const struct sockaddr_in6 * address_in6; |
74,6 → 77,29 |
return EOK; |
} |
|
int tl_get_ip_packet_dimension( int ip_phone, packet_dimensions_ref packet_dimensions, device_id_t device_id, packet_dimension_ref * packet_dimension ){ |
ERROR_DECLARE; |
|
if( ! packet_dimension ) return EBADMEM; |
|
* packet_dimension = packet_dimensions_find( packet_dimensions, device_id ); |
if( ! * packet_dimension ){ |
// ask for and remember them if not found |
* packet_dimension = malloc( sizeof( ** packet_dimension )); |
if( ! * packet_dimension ) return ENOMEM; |
if( ERROR_OCCURRED( ip_packet_size_req( ip_phone, device_id, & ( ** packet_dimension ).addr_len, & ( ** packet_dimension ).prefix, & ( ** packet_dimension ).content, & ( ** packet_dimension ).suffix ))){ |
free( * packet_dimension ); |
return ERROR_CODE; |
} |
ERROR_CODE = packet_dimensions_add( packet_dimensions, device_id, * packet_dimension ); |
if( ERROR_CODE < 0 ){ |
free( * packet_dimension ); |
return ERROR_CODE; |
} |
} |
return EOK; |
} |
|
int tl_set_address_port( struct sockaddr * addr, int addrlen, uint16_t port ){ |
struct sockaddr_in * address_in; |
struct sockaddr_in6 * address_in6; |