Changeset 9b9d1c95 in mainline for uspace/lib/net/include/ip_client.h
- Timestamp:
- 2010-10-16T16:36:38Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c62ae1d6
- Parents:
- af7638e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/include/ip_client.h
raf7638e r9b9d1c95 27 27 */ 28 28 29 /** @addtogroup ip30 * 29 /** @addtogroup libnet 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * 34 * IP client interface. 35 35 */ 36 36 37 #ifndef __NET_IP_CLIENT_H__38 #define __NET_IP_CLIENT_H__37 #ifndef LIBNET_IP_CLIENT_H_ 38 #define LIBNET_IP_CLIENT_H_ 39 39 40 40 #include <net/socket_codes.h> … … 45 45 #include <ip_interface.h> 46 46 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); 47 extern int ip_client_prepare_packet(packet_t, ip_protocol_t, ip_ttl_t, ip_tos_t, 48 int, size_t); 49 extern int ip_client_process_packet(packet_t, ip_protocol_t *, ip_ttl_t *, 50 ip_tos_t *, int *, size_t *); 51 extern size_t ip_client_header_length(packet_t); 52 extern int ip_client_set_pseudo_header_data_length(void *, size_t, size_t); 53 extern int ip_client_get_pseudo_header(ip_protocol_t, struct sockaddr *, 54 socklen_t, struct sockaddr *, socklen_t, size_t, void **, size_t *); 110 55 111 56 // TODO ipopt manipulation
Note:
See TracChangeset
for help on using the changeset viewer.