Rev 4743 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4743 | Rev 4750 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | 45 | ||
46 | #include "../include/icmp_interface.h" |
46 | #include "../include/icmp_interface.h" |
47 | #include "../include/in.h" |
47 | #include "../include/in.h" |
48 | #include "../include/in6.h" |
48 | #include "../include/in6.h" |
49 | #include "../include/inet.h" |
49 | #include "../include/inet.h" |
- | 50 | #include "../include/ip_interface.h" |
|
50 | #include "../include/socket_codes.h" |
51 | #include "../include/socket_codes.h" |
51 | #include "../include/socket_errno.h" |
52 | #include "../include/socket_errno.h" |
52 | 53 | ||
53 | #include "tl_common.h" |
54 | #include "tl_common.h" |
54 | 55 | ||
- | 56 | DEVICE_MAP_IMPLEMENT( packet_dimensions, packet_dimension_t ); |
|
- | 57 | ||
55 | int tl_get_address_port( const struct sockaddr * addr, int addrlen, uint16_t * port ){ |
58 | int tl_get_address_port( const struct sockaddr * addr, int addrlen, uint16_t * port ){ |
56 | const struct sockaddr_in * address_in; |
59 | const struct sockaddr_in * address_in; |
57 | const struct sockaddr_in6 * address_in6; |
60 | const struct sockaddr_in6 * address_in6; |
58 | 61 | ||
59 | if(( addrlen <= 0 ) || (( size_t ) addrlen < sizeof( struct sockaddr ))) return EINVAL; |
62 | if(( addrlen <= 0 ) || (( size_t ) addrlen < sizeof( struct sockaddr ))) return EINVAL; |
Line 72... | Line 75... | ||
72 | return EAFNOSUPPORT; |
75 | return EAFNOSUPPORT; |
73 | } |
76 | } |
74 | return EOK; |
77 | return EOK; |
75 | } |
78 | } |
76 | 79 | ||
- | 80 | int tl_get_ip_packet_dimension( int ip_phone, packet_dimensions_ref packet_dimensions, device_id_t device_id, packet_dimension_ref * packet_dimension ){ |
|
- | 81 | ERROR_DECLARE; |
|
- | 82 | ||
- | 83 | if( ! packet_dimension ) return EBADMEM; |
|
- | 84 | ||
- | 85 | * packet_dimension = packet_dimensions_find( packet_dimensions, device_id ); |
|
- | 86 | if( ! * packet_dimension ){ |
|
- | 87 | // ask for and remember them if not found |
|
- | 88 | * packet_dimension = malloc( sizeof( ** packet_dimension )); |
|
- | 89 | if( ! * packet_dimension ) return ENOMEM; |
|
- | 90 | if( ERROR_OCCURRED( ip_packet_size_req( ip_phone, device_id, & ( ** packet_dimension ).addr_len, & ( ** packet_dimension ).prefix, & ( ** packet_dimension ).content, & ( ** packet_dimension ).suffix ))){ |
|
- | 91 | free( * packet_dimension ); |
|
- | 92 | return ERROR_CODE; |
|
- | 93 | } |
|
- | 94 | ERROR_CODE = packet_dimensions_add( packet_dimensions, device_id, * packet_dimension ); |
|
- | 95 | if( ERROR_CODE < 0 ){ |
|
- | 96 | free( * packet_dimension ); |
|
- | 97 | return ERROR_CODE; |
|
- | 98 | } |
|
- | 99 | } |
|
- | 100 | return EOK; |
|
- | 101 | } |
|
- | 102 | ||
77 | int tl_set_address_port( struct sockaddr * addr, int addrlen, uint16_t port ){ |
103 | int tl_set_address_port( struct sockaddr * addr, int addrlen, uint16_t port ){ |
78 | struct sockaddr_in * address_in; |
104 | struct sockaddr_in * address_in; |
79 | struct sockaddr_in6 * address_in6; |
105 | struct sockaddr_in6 * address_in6; |
80 | size_t length; |
106 | size_t length; |
81 | 107 |