Changeset 4687a26c in mainline for uspace/lib/net/include/ip_client.h


Ignore:
Timestamp:
2010-11-02T18:29:01Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4f35b9ff
Parents:
76e1121f (diff), 28f4adb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/include/ip_client.h

    r76e1121f r4687a26c  
    2727 */
    2828
    29 /** @addtogroup ip
    30  *  @{
     29/** @addtogroup libnet
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  IP client interface.
     34 * IP client interface.
    3535 */
    3636
    37 #ifndef __NET_IP_CLIENT_H__
    38 #define __NET_IP_CLIENT_H__
     37#ifndef LIBNET_IP_CLIENT_H_
     38#define LIBNET_IP_CLIENT_H_
    3939
     40#include <net/socket_codes.h>
    4041#include <sys/types.h>
    4142
    42 #include <packet/packet.h>
    43 #include <ip_codes.h>
     43#include <net/packet.h>
     44#include <net/ip_codes.h>
    4445#include <ip_interface.h>
    45 #include <socket_codes.h>
    4646
    47 /** Prepares the packet to be transfered via IP.
    48  *  The IP header is prefixed.
    49  *  @param[in,out] packet The packet to be prepared.
    50  *  @param[in] protocol The transport protocol.
    51  *  @param[in] ttl The time to live counter. The IPDEFTTL is set if zero (0).
    52  *  @param[in] tos The type of service.
    53  *  @param[in] dont_fragment The value indicating whether fragmentation is disabled.
    54  *  @param[in] ipopt_length The prefixed IP options length in bytes.
    55  *  @returns EOK on success.
    56  *  @returns ENOMEM if there is not enough memory left in the packet.
    57  */
    58 extern int ip_client_prepare_packet(packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, size_t ipopt_length);
    59 
    60 /** Processes the received IP packet.
    61  *  Fills set header fields.
    62  *  Returns the prefixed IP header length.
    63  *  @param[in] packet The received packet.
    64  *  @param[out] protocol The transport protocol. May be NULL if not desired.
    65  *  @param[out] ttl The time to live counter. May be NULL if not desired.
    66  *  @param[out] tos The type of service. May be NULL if not desired.
    67  *  @param[out] dont_fragment The value indicating whether the fragmentation is disabled. May be NULL if not desired.
    68  *  @param[out] ipopt_length The IP options length in bytes. May be NULL if not desired.
    69  *  @returns The prefixed IP header length in bytes on success.
    70  *  @returns ENOMEM if the packet is too short to contain the IP header.
    71  */
    72 extern int ip_client_process_packet(packet_t packet, ip_protocol_t * protocol, ip_ttl_t * ttl, ip_tos_t * tos, int * dont_fragment, size_t * ipopt_length);
    73 
    74 /** Returns the IP header length.
    75  *  @param[in] packet The packet.
    76  *  @returns The IP header length in bytes.
    77  *  @returns Zero (0) if there is no IP header.
    78  */
    79 extern size_t ip_client_header_length(packet_t packet);
    80 
    81 /** Updates the IPv4 pseudo header data length field.
    82  *  @param[in,out] header The IPv4 pseudo header to be updated.
    83  *  @param[in] headerlen The length of the IP pseudo header in bytes.
    84  *  @param[in] data_length The data length to be set.
    85  *  @returns EOK on success.
    86  *  @returns EBADMEM if the header parameter is NULL.
    87  *  @returns EINVAL if the headerlen parameter is not IPv4 pseudo header length.
    88  */
    89 extern int ip_client_set_pseudo_header_data_length(void *header, size_t headerlen, size_t data_length);
    90 
    91 /** Constructs the IPv4 pseudo header.
    92  *  @param[in] protocol The transport protocol.
    93  *  @param[in] src The source address.
    94  *  @param[in] srclen The source address length.
    95  *  @param[in] dest The destination address.
    96  *  @param[in] destlen The destination address length.
    97  *  @param[in] data_length The data length to be set.
    98  *  @param[out] header The constructed IPv4 pseudo header.
    99  *  @param[out] headerlen The length of the IP pseudo header in bytes.
    100  *  @returns EOK on success.
    101  *  @returns EBADMEM if the header and/or the headerlen parameter is NULL.
    102  *  @returns EINVAL if the source address and/or the destination address parameter is NULL.
    103  *  @returns EINVAL if the source address length is less than struct sockaddr length.
    104  *  @returns EINVAL if the source address length differs from the destination address length.
    105  *  @returns EINVAL if the source address family differs from the destination family.
    106  *  @returns EAFNOSUPPORT if the address family is not supported.
    107  *  @returns ENOMEM if there is not enough memory left.
    108  */
    109 extern 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, void **header, size_t * headerlen);
     47extern int ip_client_prepare_packet(packet_t, ip_protocol_t, ip_ttl_t, ip_tos_t,
     48    int, size_t);
     49extern int ip_client_process_packet(packet_t, ip_protocol_t *, ip_ttl_t *,
     50    ip_tos_t *, int *, size_t *);
     51extern size_t ip_client_header_length(packet_t);
     52extern int ip_client_set_pseudo_header_data_length(void *, size_t, size_t);
     53extern int ip_client_get_pseudo_header(ip_protocol_t, struct sockaddr *,
     54    socklen_t, struct sockaddr *, socklen_t, size_t, void **, size_t *);
    11055
    11156// TODO ipopt manipulation
Note: See TracChangeset for help on using the changeset viewer.