Changeset 0b749a3 in mainline for uspace/lib/net/include/tl_common.h


Ignore:
Timestamp:
2010-11-22T15:39:53Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0eddb76, aae339e9
Parents:
9a1d8ab (diff), 8cd1aa5e (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 development/ changes

File:
1 edited

Legend:

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

    r9a1d8ab r0b749a3  
    2727 */
    2828
    29 /** @addtogroup net_tl
    30  *  @{
     29/** @addtogroup libnet
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  Transport layer common functions.
     34 * Transport layer common functions.
    3535 */
    3636
    37 #ifndef __NET_TL_COMMON_H__
    38 #define __NET_TL_COMMON_H__
     37#ifndef LIBNET_TL_COMMON_H_
     38#define LIBNET_TL_COMMON_H_
    3939
    40 #include <packet/packet.h>
    41 #include <net_device.h>
    42 #include <inet.h>
    43 #include <socket_codes.h>
     40#include <ipc/services.h>
     41
     42#include <net/socket_codes.h>
     43#include <net/packet.h>
     44#include <net/device.h>
     45#include <net/inet.h>
    4446
    4547/** Device packet dimensions.
    46  *  Maps devices to the packet dimensions.
    47  *  @see device.h
     48 * Maps devices to the packet dimensions.
     49 * @see device.h
    4850 */
    4951DEVICE_MAP_DECLARE(packet_dimensions, packet_dimension_t);
    5052
    51 extern int tl_get_ip_packet_dimension(int, packet_dimensions_ref,
    52     device_id_t, packet_dimension_ref *);
    53 
    54 /** Gets the address port.
    55  *  Supports AF_INET and AF_INET6 address families.
    56  *  @param[in,out] addr The address to be updated.
    57  *  @param[in] addrlen The address length.
    58  *  @param[out] port The set port.
    59  *  @returns EOK on success.
    60  *  @returns EINVAL if the address length does not match the address family.
    61  *  @returns EAFNOSUPPORT if the address family is not supported.
    62  */
    63 extern int tl_get_address_port(const struct sockaddr * addr, int addrlen, uint16_t * port);
    64 
    65 /** Updates IP device packet dimensions cache.
    66  *  @param[in,out] packet_dimensions The packet dimensions cache.
    67  *  @param[in] device_id The device identifier.
    68  *  @param[in] content The new maximum content size.
    69  *  @returns EOK on success.
    70  *  @returns ENOENT if the packet dimension is not cached.
    71  */
    72 extern int tl_update_ip_packet_dimension(packet_dimensions_ref packet_dimensions, device_id_t device_id, size_t content);
    73 
    74 /** Sets the address port.
    75  *  Supports AF_INET and AF_INET6 address families.
    76  *  @param[in,out] addr The address to be updated.
    77  *  @param[in] addrlen The address length.
    78  *  @param[in] port The port to be set.
    79  *  @returns EOK on success.
    80  *  @returns EINVAL if the address length does not match the address family.
    81  *  @returns EAFNOSUPPORT if the address family is not supported.
    82  */
    83 extern int tl_set_address_port(struct sockaddr * addr, int addrlen, uint16_t port);
    84 
    85 /** Prepares the packet for ICMP error notification.
    86  *  Keeps the first packet and releases all the others.
    87  *  Releases all the packets on error.
    88  *  @param[in] packet_phone The packet server module phone.
    89  *  @param[in] icmp_phone The ICMP module phone.
    90  *  @param[in] packet The packet to be send.
    91  *  @param[in] error The packet error reporting service. Prefixes the received packet.
    92  *  @returns EOK on success.
    93  *  @returns ENOENT if no packet may be sent.
    94  */
    95 extern int tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t packet, services_t error);
    96 
    97 /** Receives data from the socket into a packet.
    98  *  @param[in] packet_phone The packet server module phone.
    99  *  @param[out] packet The new created packet.
    100  *  @param[in] prefix Reserved packet data prefix length.
    101  *  @param[in] dimension The packet dimension.
    102  *  @param[in] addr The destination address.
    103  *  @param[in] addrlen The address length.
    104  *  @returns Number of bytes received.
    105  *  @returns EINVAL if the client does not send data.
    106  *  @returns ENOMEM if there is not enough memory left.
    107  *  @returns Other error codes as defined for the async_data_read_finalize() function.
    108  */
    109 extern int tl_socket_read_packet_data(int packet_phone, packet_ref packet, size_t prefix, const packet_dimension_ref dimension, const struct sockaddr * addr, socklen_t addrlen);
     53extern int tl_get_ip_packet_dimension(int, packet_dimensions_t *,
     54    device_id_t, packet_dimension_t **);
     55extern int tl_get_address_port(const struct sockaddr *, int, uint16_t *);
     56extern int tl_update_ip_packet_dimension(packet_dimensions_t *, device_id_t,
     57    size_t);
     58extern int tl_set_address_port(struct sockaddr *, int, uint16_t);
     59extern int tl_prepare_icmp_packet(int, int, packet_t *, services_t);
     60extern int tl_socket_read_packet_data(int, packet_t **, size_t,
     61    const packet_dimension_t *, const struct sockaddr *, socklen_t);
    11062
    11163#endif
Note: See TracChangeset for help on using the changeset viewer.