Subversion Repositories HelenOS

Rev

Rev 4719 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4719 Rev 4721
Line 49... Line 49...
49
 
49
 
50
int icmp_client_process_packet( packet_t packet, icmp_type_t * type, icmp_code_t * code, icmp_param_t * pointer, icmp_param_t * mtu ){
50
int icmp_client_process_packet( packet_t packet, icmp_type_t * type, icmp_code_t * code, icmp_param_t * pointer, icmp_param_t * mtu ){
51
    icmp_header_ref header;
51
    icmp_header_ref header;
52
 
52
 
53
    header = ( icmp_header_ref ) packet_get_data( packet );
53
    header = ( icmp_header_ref ) packet_get_data( packet );
54
    if( ! header ) return ENOMEM;
54
    if(( ! header )
-
 
55
    || ( packet_get_data_length( packet ) < sizeof( icmp_header_t ))){
-
 
56
        return 0;
-
 
57
    }
55
    if( type ) * type = header->type;
58
    if( type ) * type = header->type;
56
    if( code ) * code = header->code;
59
    if( code ) * code = header->code;
57
    if( pointer ) * pointer = header->un.param.pointer;
60
    if( pointer ) * pointer = header->un.param.pointer;
58
    if( mtu ) * mtu = header->un.frag.mtu;
61
    if( mtu ) * mtu = header->un.frag.mtu;
59
    return sizeof( icmp_header_t );
62
    return sizeof( icmp_header_t );
60
}
63
}
61
 
64
 
62
int icmp_client_header_length( packet_t packet ){
65
size_t icmp_client_header_length( packet_t packet ){
-
 
66
    if( packet_get_data_length( packet ) < sizeof( icmp_header_t )){
-
 
67
        return 0;
-
 
68
    }
63
    return sizeof( icmp_header_t );
69
    return sizeof( icmp_header_t );
64
}
70
}
65
 
71
 
66
/** @}
72
/** @}
67
 */
73
 */