Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/il/ip_client.c

    r46d4d9f r9b9d1c95  
    4848 *
    4949 * @param[in] packet    The packet.
    50  * @return              The IP header length in bytes.
    51  * @return              Zero if there is no IP header.
    52  */
    53 size_t ip_client_header_length(packet_t *packet)
    54 {
    55         ip_header_t *header;
    56 
    57         header = (ip_header_t *) packet_get_data(packet);
     50 * @returns             The IP header length in bytes.
     51 * @returns             Zero if there is no IP header.
     52 */
     53size_t ip_client_header_length(packet_t packet)
     54{
     55        ip_header_ref header;
     56
     57        header = (ip_header_ref) packet_get_data(packet);
    5858        if (!header || (packet_get_data_length(packet) < sizeof(ip_header_t)))
    5959                return 0;
     
    7272 * @param[out] header   The constructed IPv4 pseudo header.
    7373 * @param[out] headerlen The length of the IP pseudo header in bytes.
    74  * @return              EOK on success.
    75  * @return              EBADMEM if the header and/or the headerlen parameter is
     74 * @returns             EOK on success.
     75 * @returns             EBADMEM if the header and/or the headerlen parameter is
    7676 *                      NULL.
    77  * @return              EINVAL if the source address and/or the destination
     77 * @returns             EINVAL if the source address and/or the destination
    7878 *                      address parameter is NULL.
    79  * @return              EINVAL if the source address length is less than struct
     79 * @returns             EINVAL if the source address length is less than struct
    8080 *                      sockaddr length.
    81  * @return              EINVAL if the source address length differs from the
     81 * @returns             EINVAL if the source address length differs from the
    8282 *                      destination address length.
    83  * @return              EINVAL if the source address family differs from the
     83 * @returns             EINVAL if the source address family differs from the
    8484 *                      destination family.
    85  * @return              EAFNOSUPPORT if the address family is not supported.
    86  * @return              ENOMEM if there is not enough memory left.
     85 * @returns             EAFNOSUPPORT if the address family is not supported.
     86 * @returns             ENOMEM if there is not enough memory left.
    8787 */
    8888int
     
    9191    size_t data_length, void **header, size_t *headerlen)
    9292{
    93         ipv4_pseudo_header_t *header_in;
     93        ipv4_pseudo_header_ref header_in;
    9494        struct sockaddr_in *address_in;
    9595
     
    109109               
    110110                *headerlen = sizeof(*header_in);
    111                 header_in = (ipv4_pseudo_header_t *) malloc(*headerlen);
     111                header_in = (ipv4_pseudo_header_ref) malloc(*headerlen);
    112112                if (!header_in)
    113113                        return ENOMEM;
     
    148148 *                      disabled.
    149149 * @param[in] ipopt_length The prefixed IP options length in bytes.
    150  * @return              EOK on success.
    151  * @return              ENOMEM if there is not enough memory left in the packet.
    152  */
    153 int
    154 ip_client_prepare_packet(packet_t *packet, ip_protocol_t protocol, ip_ttl_t ttl,
     150 * @returns             EOK on success.
     151 * @returns             ENOMEM if there is not enough memory left in the packet.
     152 */
     153int
     154ip_client_prepare_packet(packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl,
    155155    ip_tos_t tos, int dont_fragment, size_t ipopt_length)
    156156{
    157         ip_header_t *header;
     157        ip_header_ref header;
    158158        uint8_t *data;
    159159        size_t padding;
     
    177177
    178178        // set the header
    179         header = (ip_header_t *) data;
     179        header = (ip_header_ref) data;
    180180        header->header_length = IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) +
    181181            ipopt_length);
     
    203203 * @param[out] ipopt_length The IP options length in bytes. May be NULL if not
    204204 *                      desired.
    205  * @return              The prefixed IP header length in bytes on success.
    206  * @return              ENOMEM if the packet is too short to contain the IP
     205 * @returns             The prefixed IP header length in bytes on success.
     206 * @returns             ENOMEM if the packet is too short to contain the IP
    207207 *                      header.
    208208 */
    209209int
    210 ip_client_process_packet(packet_t *packet, ip_protocol_t *protocol,
     210ip_client_process_packet(packet_t packet, ip_protocol_t *protocol,
    211211    ip_ttl_t *ttl, ip_tos_t *tos, int *dont_fragment, size_t *ipopt_length)
    212212{
    213         ip_header_t *header;
    214 
    215         header = (ip_header_t *) packet_get_data(packet);
     213        ip_header_ref header;
     214
     215        header = (ip_header_ref) packet_get_data(packet);
    216216        if (!header || (packet_get_data_length(packet) < sizeof(ip_header_t)))
    217217                return ENOMEM;
     
    238238 * @param[in] headerlen The length of the IP pseudo header in bytes.
    239239 * @param[in] data_length The data length to be set.
    240  * @return              EOK on success.
    241  * @return              EBADMEM if the header parameter is NULL.
    242  * @return              EINVAL if the headerlen parameter is not IPv4 pseudo
     240 * @returns             EOK on success.
     241 * @returns             EBADMEM if the header parameter is NULL.
     242 * @returns             EINVAL if the headerlen parameter is not IPv4 pseudo
    243243 *                      header length.
    244244 */
     
    247247    size_t data_length)
    248248{
    249         ipv4_pseudo_header_t *header_in;
     249        ipv4_pseudo_header_ref header_in;
    250250
    251251        if (!header)
     
    253253
    254254        if (headerlen == sizeof(ipv4_pseudo_header_t)) {
    255                 header_in = (ipv4_pseudo_header_t *) header;
     255                header_in = (ipv4_pseudo_header_ref) header;
    256256                header_in->data_length = htons(data_length);
    257257                return EOK;
Note: See TracChangeset for help on using the changeset viewer.