Subversion Repositories HelenOS

Rev

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

Rev 4728 Rev 4743
Line 115... Line 115...
115
int ip_client_get_pseudo_header( ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, ip_pseudo_header_ref * header, size_t * headerlen ){
115
int ip_client_get_pseudo_header( ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, ip_pseudo_header_ref * header, size_t * headerlen ){
116
    ipv4_pseudo_header_ref  header_in;
116
    ipv4_pseudo_header_ref  header_in;
117
    struct sockaddr_in *    address_in;
117
    struct sockaddr_in *    address_in;
118
 
118
 
119
    if( !( header && headerlen )) return EBADMEM;
119
    if( !( header && headerlen )) return EBADMEM;
120
    if( !( src && dest && ( srclen >= sizeof( struct sockaddr )) && ( srclen == destlen ) && ( src->sa_family == dest->sa_family ))) return EINVAL;
120
    if( !( src && dest && ( srclen > 0 ) && (( size_t ) srclen >= sizeof( struct sockaddr )) && ( srclen == destlen ) && ( src->sa_family == dest->sa_family ))) return EINVAL;
121
    switch( src->sa_family ){
121
    switch( src->sa_family ){
122
        case AF_INET:
122
        case AF_INET:
123
            if( srclen != sizeof( struct sockaddr_in )) return EINVAL;
123
            if( srclen != sizeof( struct sockaddr_in )) return EINVAL;
124
            * headerlen = sizeof( * header_in );
124
            * headerlen = sizeof( * header_in );
125
            header_in = ( ipv4_pseudo_header_ref ) malloc( * headerlen );
125
            header_in = ( ipv4_pseudo_header_ref ) malloc( * headerlen );