Ignore:
File:
1 edited

Legend:

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

    r14f1db0 r849ed54  
    3131 */
    3232
     33/** @file
     34 *  IP module interface.
     35 *  The same interface is used for standalone remote modules as well as for bundle modules.
     36 *  The standalone remote modules have to be compiled with the ip_remote.c source file.
     37 *  The bundle modules with the ip.c source file.
     38 */
     39
    3340#ifndef __NET_IP_INTERFACE_H__
    3441#define __NET_IP_INTERFACE_H__
     
    4451#include <socket_codes.h>
    4552
    46 #ifdef CONFIG_IL_TL_BUNDLE
    47 
    48 #include <ip_local.h>
    49 
    50 #define ip_received_error_msg  ip_received_error_msg_local
    51 #define ip_set_gateway_req     ip_set_gateway_req_local
    52 #define ip_packet_size_req     ip_packet_size_req_local
    53 #define ip_device_req          ip_device_req_local
    54 #define ip_add_route_req       ip_add_route_req_local
    55 #define ip_send_msg            ip_send_msg_local
    56 #define ip_get_route_req       ip_get_route_req_local
    57 
    58 #else
    59 
    60 #include <ip_remote.h>
    61 
    62 #define ip_received_error_msg  ip_received_error_msg_remote
    63 #define ip_set_gateway_req     ip_set_gateway_req_remote
    64 #define ip_packet_size_req     ip_packet_size_req_remote
    65 #define ip_device_req          ip_device_req_remote
    66 #define ip_add_route_req       ip_add_route_req_remote
    67 #define ip_send_msg            ip_send_msg_remote
    68 #define ip_get_route_req       ip_get_route_req_remote
    69 
    70 #endif
    71 
    7253/** @name IP module interface
    7354 *  This interface is used by other modules.
    7455 */
    7556/*@{*/
     57
     58/** Type definition of the internet pseudo header pointer.
     59 */
     60typedef void *          ip_pseudo_header_ref;
    7661
    7762/** The transport layer notification function type definition.
     
    9782extern int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg);
    9883
     84/** Registers the new device.
     85 *  Registers itself as the ip packet receiver.
     86 *  If the device uses ARP registers also the new ARP device.
     87 *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
     88 *  @param[in] device_id The new device identifier.
     89 *  @param[in] netif The underlying device network interface layer service.
     90 *  @returns EOK on success.
     91 *  @returns ENOMEM if there is not enough memory left.
     92 *  @returns EINVAL if the device configuration is invalid.
     93 *  @returns ENOTSUP if the device uses IPv6.
     94 *  @returns ENOTSUP if the device uses DHCP.
     95 *  @returns Other error codes as defined for the net_get_device_conf_req() function.
     96 *  @returns Other error codes as defined for the arp_device_req() function.
     97 */
     98extern int ip_device_req(int ip_phone, device_id_t device_id, services_t netif);
     99
     100/** Sends the packet queue.
     101 *  The packets may get fragmented if needed.
     102 *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
     103 *  @param[in] device_id The device identifier.
     104 *  @param[in] packet The packet fragments as a~packet queue. All the packets have to have the same destination address.
     105 *  @param[in] sender The sending module service.
     106 *  @param[in] error The packet error reporting service. Prefixes the received packet.
     107 *  @returns EOK on success.
     108 *  @returns Other error codes as defined for the generic_send_msg() function.
     109 */
     110extern int ip_send_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error);
     111
    99112/** Connects to the IP module.
    100113 *  @param service The IP module service. Ignored parameter.
     
    104117extern int ip_connect_module(services_t service);
    105118
     119/** Adds a route to the device routing table.
     120 *  The target network is routed using this device.
     121 *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
     122 *  @param[in] device_id The device identifier.
     123 *  @param[in] address The target network address.
     124 *  @param[in] netmask The target network mask.
     125 *  @param[in] gateway The target network gateway. Not used if zero.
     126 */
     127extern int ip_add_route_req(int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway);
     128
     129/** Sets the default gateway.
     130 *  This gateway is used if no other route is found.
     131 *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
     132 *  @param[in] device_id The device identifier.
     133 *  @param[in] gateway The default gateway.
     134 */
     135extern int ip_set_gateway_req(int ip_phone, device_id_t device_id, in_addr_t gateway);
     136
     137/** Returns the device packet dimension for sending.
     138 *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
     139 *  @param[in] device_id The device identifier.
     140 *  @param[out] packet_dimension The packet dimension.
     141 *  @returns EOK on success.
     142 *  @returns ENOENT if there is no such device.
     143 *  @returns Other error codes as defined for the generic_packet_size_req() function.
     144 */
     145extern int ip_packet_size_req(int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension);
     146
     147/** Notifies the IP module about the received error notification packet.
     148 *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
     149 *  @param[in] device_id The device identifier.
     150 *  @param[in] packet The received packet or the received packet queue.
     151 *  @param[in] target The target internetwork module service to be delivered to.
     152 *  @param[in] error The packet error reporting service. Prefixes the received packet.
     153 *  @returns EOK on success.
     154 */
     155extern int ip_received_error_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error);
     156
     157/** Returns the device identifier and the IP pseudo header based on the destination address.
     158 *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
     159 *  @param[in] protocol The transport protocol.
     160 *  @param[in] destination The destination address.
     161 *  @param[in] addrlen The destination address length.
     162 *  @param[out] device_id The device identifier.
     163 *  @param[out] header The constructed IP pseudo header.
     164 *  @param[out] headerlen The IP pseudo header length.
     165 */
     166extern int ip_get_route_req(int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen);
     167
    106168/*@}*/
    107169
Note: See TracChangeset for help on using the changeset viewer.