Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4749 → Rev 4750

/branches/network/uspace/srv/net/tl/udp/udp.c
205,8 → 205,13
if( udp_globals.ip_phone < 0 ){
return udp_globals.ip_phone;
}
// read default packet dimensions
ERROR_PROPAGATE( ip_packet_size_req( udp_globals.ip_phone, -1, & udp_globals.packet_dimension.addr_len, & udp_globals.packet_dimension.prefix, & udp_globals.packet_dimension.content, & udp_globals.packet_dimension.suffix ));
ERROR_PROPAGATE( socket_ports_initialize( & udp_globals.sockets ));
if( ERROR_OCCURRED( packet_dimensions_initialize( & udp_globals.dimensions ))){
socket_ports_destroy( & udp_globals.sockets );
return ERROR_CODE;
}
udp_globals.packet_dimension.prefix += sizeof( udp_header_t );
udp_globals.packet_dimension.content -= sizeof( udp_header_t );
udp_globals.last_used_port = UDP_FREE_PORTS_START - 1;
525,6 → 530,7
ip_pseudo_header_ref ip_header;
size_t headerlen;
device_id_t device_id;
packet_dimension_ref packet_dimension;
 
ERROR_PROPAGATE( tl_get_address_port( addr, addrlen, & dest_port ));
 
553,11 → 559,21
// }while( socket->port <= 0 );
}
 
// TODO do not ask all the time
ERROR_PROPAGATE( ip_packet_size_req( udp_globals.ip_phone, -1, & udp_globals.packet_dimension.addr_len, & udp_globals.packet_dimension.prefix, & udp_globals.packet_dimension.content, & udp_globals.packet_dimension.suffix ));
if( udp_globals.checksum_computing ){
if( ERROR_OCCURRED( ip_get_route_req( udp_globals.ip_phone, IPPROTO_UDP, addr, addrlen, & device_id, & ip_header, & headerlen ))){
return udp_release_and_return( packet, ERROR_CODE );
}
// get the device packet dimension
// ERROR_PROPAGATE( tl_get_ip_packet_dimension( udp_globals.ip_phone, & udp_globals.dimensions, device_id, & packet_dimension ));
}
// }else{
// do not ask all the time
ERROR_PROPAGATE( ip_packet_size_req( udp_globals.ip_phone, -1, & udp_globals.packet_dimension.addr_len, & udp_globals.packet_dimension.prefix, & udp_globals.packet_dimension.content, & udp_globals.packet_dimension.suffix ));
packet_dimension = & udp_globals.packet_dimension;
// }
 
// read the first packet fragment
result = tl_socket_read_packet_data( udp_globals.net_phone, & packet, sizeof( udp_header_t ), & udp_globals.packet_dimension, addr, addrlen );
result = tl_socket_read_packet_data( udp_globals.net_phone, & packet, sizeof( udp_header_t ), packet_dimension, addr, addrlen );
if( result < 0 ) return result;
total_length = ( size_t ) result;
if( udp_globals.checksum_computing ){
573,7 → 589,7
bzero( header, sizeof( * header ));
// read the rest of the packet fragments
for( index = 1; index < fragments; ++ index ){
result = tl_socket_read_packet_data( udp_globals.net_phone, & next_packet, 0, & udp_globals.packet_dimension, addr, addrlen );
result = tl_socket_read_packet_data( udp_globals.net_phone, & next_packet, 0, packet_dimension, addr, addrlen );
if( result < 0 ){
return udp_release_and_return( packet, result );
}
589,9 → 605,9
header->total_length = htons( total_length + sizeof( * header ));
header->checksum = 0;
if( udp_globals.checksum_computing ){
if( ERROR_OCCURRED( ip_get_route_req( udp_globals.ip_phone, IPPROTO_UDP, addr, addrlen, & device_id, & ip_header, & headerlen ))){
return udp_release_and_return( packet, ERROR_CODE );
}
// if( ERROR_OCCURRED( ip_get_route_req( udp_globals.ip_phone, IPPROTO_UDP, addr, addrlen, & device_id, & ip_header, & headerlen ))){
// return udp_release_and_return( packet, ERROR_CODE );
// }
if( ERROR_OCCURRED( ip_client_set_pseudo_header_data_length( ip_header, headerlen, total_length + sizeof( udp_header_t )))){
free( ip_header );
return udp_release_and_return( packet, ERROR_CODE );