Changeset 14f1db0 in mainline for uspace/lib/net/include
- Timestamp:
- 2010-04-09T12:54:57Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a1caa3c2
- Parents:
- 24ab58b3
- Location:
- uspace/lib/net/include
- Files:
-
- 4 added
- 2 deleted
- 13 edited
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/include/arp_interface.h
r24ab58b3 r14f1db0 29 29 /** @addtogroup arp 30 30 * @{ 31 */32 33 /** @file34 * ARP 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 arp_remote.c source file.37 * The bundle modules with the arp.c source file.38 31 */ 39 32 -
uspace/lib/net/include/icmp_interface.h
r24ab58b3 r14f1db0 29 29 /** @addtogroup icmp 30 30 * @{ 31 */32 33 /** @file34 * ICMP 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 icmp_remote.c source file.37 * The bundle modules with the icmp.c source file.38 31 */ 39 32 -
uspace/lib/net/include/il_interface.h
r24ab58b3 r14f1db0 32 32 33 33 /** @file 34 * 35 * This interface is always called by the standalone remote modules.34 * Internetwork layer module interface for the underlying network interface layer. 35 * This interface is always called by the remote modules. 36 36 */ 37 37 … … 50 50 51 51 /** @name Internetwork layer module interface 52 * 52 * This interface is used by other modules. 53 53 */ 54 54 /*@{*/ 55 55 56 /** Notifies the internetwork layer modules about the device state change. 57 * @param[in] il_phone The internetwork layer module phone used for (semi)remote calls. 58 * @param[in] device_id The device identifier. 59 * @param[in] state The new device state. 60 * @param[in] target The target internetwork module service to be delivered to. 61 * @returns EOK on success. 56 /** Notify the internetwork layer modules about the device state change. 57 * 58 * @param[in] il_phone The internetwork layer module phone used for 59 * (semi)remote calls. 60 * @param[in] device_id The device identifier. 61 * @param[in] state The new device state. 62 * @param[in] target The target internetwork module service to be 63 * delivered to. 64 * 65 * @return EOK on success. 66 * 62 67 */ 63 static inline int il_device_state_msg(int il_phone, device_id_t device_id, device_state_t state, services_t target){ 64 return generic_device_state_msg(il_phone, NET_IL_DEVICE_STATE, device_id, state, target); 68 static inline int il_device_state_msg(int il_phone, device_id_t device_id, 69 device_state_t state, services_t target) 70 { 71 return generic_device_state_msg_remote(il_phone, NET_IL_DEVICE_STATE, 72 device_id, state, target); 65 73 } 66 74 67 /** Notifies the internetwork layer modules about the received packet/s. 68 * @param[in] il_phone The internetwork layer module phone used for (semi)remote calls. 69 * @param[in] device_id The device identifier. 70 * @param[in] packet The received packet or the received packet queue. 71 * @param[in] target The target internetwork module service to be delivered to. 72 * @returns EOK on success. 75 /** Notify the internetwork layer modules about the received packet/s. 76 * 77 * @param[in] il_phone The internetwork layer module phone used for 78 * (semi)remote calls. 79 * @param[in] device_id The device identifier. 80 * @param[in] packet The received packet or the received packet queue. 81 * @param[in] target The target internetwork module service to be 82 * delivered to. 83 * 84 * @return EOK on success. 85 * 73 86 */ 74 inline static int il_received_msg(int il_phone, device_id_t device_id, packet_t packet, services_t target){ 75 return generic_received_msg(il_phone, NET_IL_RECEIVED, device_id, packet_get_id(packet), target, 0); 87 inline static int il_received_msg(int il_phone, device_id_t device_id, 88 packet_t packet, services_t target) 89 { 90 return generic_received_msg_remote(il_phone, NET_IL_RECEIVED, device_id, 91 packet_get_id(packet), target, 0); 76 92 } 77 93 78 /** Notifies the internetwork layer modules about the mtu change. 79 * @param[in] il_phone The internetwork layer module phone used for (semi)remote calls. 80 * @param[in] device_id The device identifier. 81 * @param[in] mtu The new mtu value. 82 * @param[in] target The target internetwork module service to be delivered to. 83 * @returns EOK on success. 94 /** Notify the internetwork layer modules about the mtu change. 95 * 96 * @param[in] il_phone The internetwork layer module phone used for 97 * (semi)remote calls. 98 * @param[in] device_id The device identifier. 99 * @param[in] mtu The new mtu value. 100 * @param[in] target The target internetwork module service to be 101 * delivered to. 102 * 103 * @return EOK on success. 104 * 84 105 */ 85 inline static int il_mtu_changed_msg(int il_phone, device_id_t device_id, size_t mtu, services_t target){ 86 return generic_device_state_msg(il_phone, NET_IL_MTU_CHANGED, device_id, (int) mtu, target); 106 inline static int il_mtu_changed_msg(int il_phone, device_id_t device_id, 107 size_t mtu, services_t target) 108 { 109 return generic_device_state_msg_remote(il_phone, NET_IL_MTU_CHANGED, 110 device_id, (int) mtu, target); 87 111 } 88 112 -
uspace/lib/net/include/il_local.h
r24ab58b3 r14f1db0 27 27 */ 28 28 29 /** @addtogroup il_ standalone29 /** @addtogroup il_local 30 30 * @{ 31 31 */ 32 32 33 #ifndef __IL_ STANDALONE_H__34 #define __IL_ STANDALONE_H__33 #ifndef __IL_LOCAL_H__ 34 #define __IL_LOCAL_H__ 35 35 36 36 #include <ipc/ipc.h> 37 37 #include <async.h> 38 38 39 extern int il_module_message (ipc_callid_t callid, ipc_call_t *call,39 extern int il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call, 40 40 ipc_call_t *answer, int *answer_count); 41 extern int il_module_start (async_client_conn_t client_connection);41 extern int il_module_start_standalone(async_client_conn_t client_connection); 42 42 43 43 #endif -
uspace/lib/net/include/il_messages.h
r24ab58b3 r14f1db0 28 28 29 29 /** @addtogroup net_il 30 * 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * 35 * 36 * 34 * Internetwork layer modules messages. 35 * @see il_interface.h 36 * @see ip_interface.h 37 37 */ 38 38 … … 72 72 73 73 /** @name Internetwork layer specific message parameters definitions 74 * 74 75 */ 75 76 /*@{*/ 76 77 77 /** Returns the protocol number message parameter. 78 * @param[in] call The message call structure. 78 /** Return the protocol number message parameter. 79 * @param[in] call The message call structure. 80 * 79 81 */ 80 #define IL_GET_PROTO(call) 82 #define IL_GET_PROTO(call) (int) IPC_GET_ARG1(*call) 81 83 82 /** Returns the registering service message parameter. 83 * @param[in] call The message call structure. 84 /** Return the registering service message parameter. 85 * @param[in] call The message call structure. 86 * 84 87 */ 85 #define IL_GET_SERVICE(call) 88 #define IL_GET_SERVICE(call) (services_t) IPC_GET_ARG2(*call) 86 89 87 90 /*@}*/ -
uspace/lib/net/include/ip_client.h
r24ab58b3 r14f1db0 87 87 * @returns EINVAL if the headerlen parameter is not IPv4 pseudo header length. 88 88 */ 89 extern int ip_client_set_pseudo_header_data_length( ip_pseudo_header_refheader, size_t headerlen, size_t data_length);89 extern int ip_client_set_pseudo_header_data_length(void *header, size_t headerlen, size_t data_length); 90 90 91 91 /** Constructs the IPv4 pseudo header. … … 107 107 * @returns ENOMEM if there is not enough memory left. 108 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, ip_pseudo_header_ref *header, size_t * headerlen);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); 110 110 111 111 // TODO ipopt manipulation -
uspace/lib/net/include/ip_interface.h
r24ab58b3 r14f1db0 31 31 */ 32 32 33 /** @file34 * 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 40 33 #ifndef __NET_IP_INTERFACE_H__ 41 34 #define __NET_IP_INTERFACE_H__ … … 51 44 #include <socket_codes.h> 52 45 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 53 72 /** @name IP module interface 54 73 * This interface is used by other modules. 55 74 */ 56 75 /*@{*/ 57 58 /** Type definition of the internet pseudo header pointer.59 */60 typedef void * ip_pseudo_header_ref;61 76 62 77 /** The transport layer notification function type definition. … … 82 97 extern int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg); 83 98 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 */98 extern int ip_device_req(int, device_id_t, services_t);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 */110 extern int ip_send_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error);111 112 99 /** Connects to the IP module. 113 100 * @param service The IP module service. Ignored parameter. … … 117 104 extern int ip_connect_module(services_t service); 118 105 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 */127 extern 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 */135 extern 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 */145 extern 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 */155 extern 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 */166 extern 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 168 106 /*@}*/ 169 107 -
uspace/lib/net/include/net_interface.h
r24ab58b3 r14f1db0 29 29 /** @addtogroup net 30 30 * @{ 31 */32 33 /** @file34 * Networking 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 net_remote.c source file.37 * The bundle networking module is compiled with the net_bundle.c source file and the choosen bundle module implementation source files.38 31 */ 39 32 -
uspace/lib/net/include/netif_interface.h
r24ab58b3 r14f1db0 28 28 29 29 /** @addtogroup netif 30 * @{ 31 */ 32 33 /** @file 34 * Network interface module interface. 35 * The same interface is used for standalone remote modules as well as for bundle network interface layer modules. 36 * The standalone remote modules have to be compiled with the netif_remote.c source file. 37 * The bundle network interface layer modules are compiled with the netif_nil_bundle.c source file and the choosen network interface layer implementation source file. 30 * @{ 38 31 */ 39 32 … … 41 34 #define __NET_NETIF_INTERFACE_H__ 42 35 43 #i nclude <ipc/services.h>36 #ifdef CONFIG_NETIF_NIL_BUNDLE 44 37 45 #include <net_messages.h> 46 #include <adt/measured_strings.h> 47 #include <packet/packet.h> 48 #include <net_device.h> 38 #include <netif_local.h> 39 #include <netif_nil_bundle.h> 40 #include <packet/packet_server.h> 49 41 50 /** @name Network interface module interface 51 * This interface is used by other modules. 52 */ 53 /*@{*/ 42 #define netif_module_message netif_nil_module_message 43 #define netif_module_start netif_nil_module_start 44 #define netif_get_addr_req netif_get_addr_req_local 45 #define netif_probe_req netif_probe_req_local 46 #define netif_send_msg netif_send_msg_local 47 #define netif_start_req netif_start_req_local 48 #define netif_stop_req netif_stop_req_local 49 #define netif_stats_req netif_stats_req_local 50 #define netif_bind_service netif_bind_service_local 54 51 55 /** Returns the device local hardware address. 56 * @param[in] netif_phone The network interface phone. 57 * @param[in] device_id The device identifier. 58 * @param[out] address The device local hardware address. 59 * @param[out] data The address data. 60 * @returns EOK on success. 61 * @returns EBADMEM if the address parameter is NULL. 62 * @returns ENOENT if there no such device. 63 * @returns Other error codes as defined for the netif_get_addr_message() function. 64 */ 65 extern int netif_get_addr_req(int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data); 52 #else /* CONFIG_NETIF_NIL_BUNDLE */ 66 53 67 /** Probes the existence of the device. 68 * @param[in] netif_phone The network interface phone. 69 * @param[in] device_id The device identifier. 70 * @param[in] irq The device interrupt number. 71 * @param[in] io The device input/output address. 72 * @returns EOK on success. 73 * @returns Other errro codes as defined for the netif_probe_message(). 74 */ 75 extern int netif_probe_req(int netif_phone, device_id_t device_id, int irq, int io); 54 #include <netif_remote.h> 55 #include <packet/packet_client.h> 76 56 77 /** Sends the packet queue. 78 * @param[in] netif_phone The network interface phone. 79 * @param[in] device_id The device identifier. 80 * @param[in] packet The packet queue. 81 * @param[in] sender The sending module service. 82 * @returns EOK on success. 83 * @returns Other error codes as defined for the generic_send_msg() function. 84 */ 85 extern int netif_send_msg(int netif_phone, device_id_t device_id, packet_t packet, services_t sender); 57 #define netif_module_message netif_module_message_standalone 58 #define netif_module_start netif_module_start_standalone 59 #define netif_get_addr_req netif_get_addr_req_remote 60 #define netif_probe_req netif_probe_req_remote 61 #define netif_send_msg netif_send_msg_remote 62 #define netif_start_req netif_start_req_remote 63 #define netif_stop_req netif_stop_req_remote 64 #define netif_stats_req netif_stats_req_remote 65 #define netif_bind_service netif_bind_service_remote 86 66 87 /** Starts the device. 88 * @param[in] netif_phone The network interface phone. 89 * @param[in] device_id The device identifier. 90 * @returns EOK on success. 91 * @returns Other error codes as defined for the find_device() function. 92 * @returns Other error codes as defined for the netif_start_message() function. 93 */ 94 extern int netif_start_req(int netif_phone, device_id_t device_id); 95 96 /** Stops the device. 97 * @param[in] netif_phone The network interface phone. 98 * @param[in] device_id The device identifier. 99 * @returns EOK on success. 100 * @returns Other error codes as defined for the find_device() function. 101 * @returns Other error codes as defined for the netif_stop_message() function. 102 */ 103 extern int netif_stop_req(int netif_phone, device_id_t device_id); 104 105 /** Returns the device usage statistics. 106 * @param[in] netif_phone The network interface phone. 107 * @param[in] device_id The device identifier. 108 * @param[out] stats The device usage statistics. 109 * @returns EOK on success. 110 */ 111 extern int netif_stats_req(int netif_phone, device_id_t device_id, device_stats_ref stats); 112 113 /** Creates bidirectional connection with the network interface module and registers the message receiver. 114 * @param[in] service The network interface module service. 115 * @param[in] device_id The device identifier. 116 * @param[in] me The requesting module service. 117 * @param[in] receiver The message receiver. 118 * @returns The phone of the needed service. 119 * @returns EOK on success. 120 * @returns Other error codes as defined for the bind_service() function. 121 */ 122 extern int netif_bind_service(services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver); 123 124 /*@}*/ 67 #endif /* CONFIG_NETIF_NIL_BUNDLE */ 125 68 126 69 #endif -
uspace/lib/net/include/netif_messages.h
r24ab58b3 r14f1db0 28 28 29 29 /** @addtogroup netif 30 * 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Network interface common module messages. 35 * @see netif_interface.h 34 * Network interface common module messages. 36 35 */ 37 36 … … 76 75 /*@{*/ 77 76 78 /** Return sthe interrupt number message parameter.79 * 77 /** Return the interrupt number message parameter. 78 * @param[in] call The message call structure. 80 79 */ 81 80 #define NETIF_GET_IRQ(call) \ 82 81 ({int irq = (int) IPC_GET_ARG2(*call); irq;}) 83 82 84 /** Return sthe input/output address message parameter.85 * 83 /** Return the input/output address message parameter. 84 * @param[in] call The message call structure. 86 85 */ 87 86 #define NETIF_GET_IO(call) \ -
uspace/lib/net/include/nil_interface.h
r24ab58b3 r14f1db0 31 31 */ 32 32 33 /** @file34 * Network interface layer module interface.35 * The same interface is used for standalone remote device modules as well as for bundle device modules.36 * The standalone remote device modules have to be compiled with the nil_remote.c source file.37 * The bundle device modules with the appropriate network interface layer source file (eth.c etc.).38 * The upper layers cannot be bundled with the network interface layer.39 */40 41 33 #ifndef __NET_NIL_INTERFACE_H__ 42 34 #define __NET_NIL_INTERFACE_H__ … … 53 45 #include <net_device.h> 54 46 55 /** @name Network interface layer module interface 56 * This interface is used by other modules. 57 */ 58 /*@{*/ 47 #define nil_bind_service(service, device_id, me, receiver) \ 48 bind_service(service, device_id, me, 0, receiver) 59 49 60 /** Returns the device local hardware address. 61 * @param[in] nil_phone The network interface layer phone. 62 * @param[in] device_id The device identifier. 63 * @param[out] address The device local hardware address. 64 * @param[out] data The address data. 65 * @returns EOK on success. 66 * @returns EBADMEM if the address parameter and/or the data parameter is NULL. 67 * @returns ENOENT if there no such device. 68 * @returns Other error codes as defined for the generic_get_addr_req() function. 69 */ 70 #define nil_get_addr_req(nil_phone, device_id, address, data) \ 50 #define nil_packet_size_req(nil_phone, device_id, packet_dimension) \ 51 generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, device_id, \ 52 packet_dimension) 53 54 #define nil_get_addr_req(nil_phone, device_id, address, data) \ 71 55 generic_get_addr_req(nil_phone, NET_NIL_ADDR, device_id, address, data) 72 56 73 /** Returns the device broadcast hardware address. 74 * @param[in] nil_phone The network interface layer phone. 75 * @param[in] device_id The device identifier. 76 * @param[out] address The device broadcast hardware address. 77 * @param[out] data The address data. 78 * @returns EOK on success. 79 * @returns EBADMEM if the address parameter is NULL. 80 * @returns ENOENT if there no such device. 81 * @returns Other error codes as defined for the generic_get_addr_req() function. 82 */ 83 #define nil_get_broadcast_addr_req(nil_phone, device_id, address, data) \ 84 generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, address, data) 57 #define nil_get_broadcast_addr_req(nil_phone, device_id, address, data) \ 58 generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, \ 59 address, data) 85 60 86 /** Sends the packet queue. 87 * @param[in] nil_phone The network interface layer phone. 88 * @param[in] device_id The device identifier. 89 * @param[in] packet The packet queue. 90 * @param[in] sender The sending module service. 91 * @returns EOK on success. 92 * @returns Other error codes as defined for the generic_send_msg() function. 93 */ 94 #define nil_send_msg(nil_phone, device_id, packet, sender) \ 95 generic_send_msg(nil_phone, NET_NIL_SEND, device_id, packet_get_id(packet), sender, 0) 61 #define nil_send_msg(nil_phone, device_id, packet, sender) \ 62 generic_send_msg_remote(nil_phone, NET_NIL_SEND, device_id, \ 63 packet_get_id(packet), sender, 0) 96 64 97 /** Returns the device packet dimension for sending. 98 * @param[in] nil_phone The network interface layer phone. 99 * @param[in] device_id The device identifier. 100 * @param[out] packet_dimension The packet dimensions. 101 * @returns EOK on success. 102 * @returns ENOENT if there is no such device. 103 * @returns Other error codes as defined for the generic_packet_size_req() function. 104 */ 105 #define nil_packet_size_req(nil_phone, device_id, packet_dimension) \ 106 generic_packet_size_req(nil_phone, NET_NIL_PACKET_SPACE, device_id, packet_dimension) 65 #define nil_device_req(nil_phone, device_id, mtu, netif_service) \ 66 generic_device_req_remote(nil_phone, NET_NIL_DEVICE, device_id, mtu, \ 67 netif_service) 107 68 108 /** Registers new device or updates the MTU of an existing one.109 * @param[in] nil_phone The network interface layer phone.110 * @param[in] device_id The new device identifier.111 * @param[in] mtu The device maximum transmission unit.112 * @param[in] netif_service The device driver service.113 * @returns EOK on success.114 * @returns EEXIST if the device with the different service exists.115 * @returns ENOMEM if there is not enough memory left.116 * @returns Other error codes as defined for the generic_device_req() function.117 */118 #define nil_device_req(nil_phone, device_id, mtu, netif_service) \119 generic_device_req(nil_phone, NET_NIL_DEVICE, device_id, mtu, netif_service)120 69 121 /** Notifies the network interface layer about the device state change. 122 * @param[in] nil_phone The network interface layer phone. 123 * @param[in] device_id The device identifier. 124 * @param[in] state The new device state. 125 * @returns EOK on success. 126 * @returns Other error codes as defined for each specific module device state function. 127 */ 128 extern int nil_device_state_msg(int nil_phone, device_id_t device_id, int state); 70 #ifdef CONFIG_NETIF_NIL_BUNDLE 129 71 130 /** Passes the packet queue to the network interface layer. 131 * Processes and redistributes the received packet queue to the registered upper layers. 132 * @param[in] nil_phone The network interface layer phone. 133 * @param[in] device_id The source device identifier. 134 * @param[in] packet The received packet or the received packet queue. 135 * @param target The target service. Ignored parameter. 136 * @returns EOK on success. 137 * @returns Other error codes as defined for each specific module received function. 138 */ 139 extern int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target); 72 #include <nil_local.h> 73 #include <packet/packet_server.h> 140 74 141 /** Creates bidirectional connection with the network interface layer module and registers the message receiver. 142 * @param[in] service The network interface layer module service. 143 * @param[in] device_id The device identifier. 144 * @param[in] me The requesting module service. 145 * @param[in] receiver The message receiver. 146 * @returns The phone of the needed service. 147 * @returns EOK on success. 148 * @returns Other error codes as defined for the bind_service() function. 149 */ 150 #define nil_bind_service(service, device_id, me, receiver) \151 bind_service(service, device_id, me, 0, receiver); 152 /*@}*/75 #define nil_device_state_msg nil_device_state_msg_local 76 #define nil_received_msg nil_received_msg_local 77 78 #else /* CONFIG_NETIF_NIL_BUNDLE */ 79 80 #include <nil_remote.h> 81 #include <packet/packet_server.h> 82 83 #define nil_device_state_msg nil_device_state_msg_remote 84 #define nil_received_msg nil_received_msg_remote 85 86 #endif /* CONFIG_NETIF_NIL_BUNDLE */ 153 87 154 88 #endif -
uspace/lib/net/include/nil_local.h
r24ab58b3 r14f1db0 32 32 33 33 /** @file 34 * 35 * 34 * Network interface layer modules common skeleton. 35 * All network interface layer modules have to implement this interface. 36 36 */ 37 37 38 #ifndef __NET_NIL_ MODULE_H__39 #define __NET_NIL_ MODULE_H__38 #ifndef __NET_NIL_LOCAL_H__ 39 #define __NET_NIL_LOCAL_H__ 40 40 41 41 #include <ipc/ipc.h> … … 52 52 */ 53 53 extern int nil_initialize(int); 54 55 extern int nil_device_state_msg_local(int, device_id_t, int); 56 extern int nil_received_msg_local(int, device_id_t, packet_t, services_t); 54 57 55 58 /** Message processing function. … … 71 74 * 72 75 */ 73 extern int nil_message (const char *, ipc_callid_t, ipc_call_t *, ipc_call_t *,76 extern int nil_message_standalone(const char *, ipc_callid_t, ipc_call_t *, ipc_call_t *, 74 77 int *); 78 79 extern int nil_module_message_standalone(const char *, ipc_callid_t, 80 ipc_call_t *, ipc_call_t *, int *); 81 extern int nil_module_start_standalone(async_client_conn_t); 75 82 76 83 #endif -
uspace/lib/net/include/nil_messages.h
r24ab58b3 r14f1db0 28 28 29 29 /** @addtogroup net_nil 30 * 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Network interface layer module messages. 35 * @see nil_interface.h 34 * Network interface layer module messages. 36 35 */ 37 36 … … 43 42 #include <net_messages.h> 44 43 45 /** 44 /** Network interface layer module messages. 46 45 */ 47 46 typedef enum { … … 80 79 /*@{*/ 81 80 82 /** Return sthe protocol service message parameter.81 /** Return the protocol service message parameter. 83 82 */ 84 83 #define NIL_GET_PROTO(call) \ -
uspace/lib/net/include/nil_remote.h
r24ab58b3 r14f1db0 1 1 /* 2 * Copyright (c) 20 10 Martin Decky2 * Copyright (c) 2009 Lukas Mejdrech 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup netif _standalone30 * 29 /** @addtogroup netif 30 * @{ 31 31 */ 32 32 33 #ifndef __NET IF_STANDALONE_H__34 #define __NET IF_STANDALONE_H__33 #ifndef __NET_NIL_REMOTE_H__ 34 #define __NET_NIL_REMOTE_H__ 35 35 36 #include <async.h> 37 #include <fibril_synch.h> 36 38 #include <ipc/ipc.h> 37 #include <async.h>38 39 39 extern int netif_module_message(const char *, ipc_callid_t, ipc_call_t *, 40 ipc_call_t *, int *); 41 extern int netif_module_start(async_client_conn_t); 40 extern int nil_device_state_msg_remote(int, device_id_t, int); 41 extern int nil_received_msg_remote(int, device_id_t, packet_t, services_t); 42 42 43 43 #endif -
uspace/lib/net/include/packet_remote.h
r24ab58b3 r14f1db0 1 1 /* 2 * Copyright (c) 20 10 Martin Decky2 * Copyright (c) 2009 Lukas Mejdrech 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup tl_standalone30 * 29 /** @addtogroup packet 30 * @{ 31 31 */ 32 32 33 #ifndef __ TL_STANDALONE_H__34 #define __ TL_STANDALONE_H__33 #ifndef __NET_PACKET_REMOTE_H__ 34 #define __NET_PACKET_REMOTE_H__ 35 35 36 #include <ipc/ipc.h> 37 #include <async.h> 36 #include <packet/packet.h> 38 37 39 extern int tl_module_message(ipc_callid_t callid, ipc_call_t *call, 40 ipc_call_t *answer, int *answer_count); 41 extern int tl_module_start(async_client_conn_t client_connection); 38 extern int packet_translate_remote(int, packet_ref, packet_id_t); 39 extern packet_t packet_get_4_remote(int, size_t, size_t, size_t, size_t); 40 extern packet_t packet_get_1_remote(int, size_t); 41 extern void pq_release_remote(int, packet_id_t); 42 42 43 43 #endif -
uspace/lib/net/include/tl_common.h
r24ab58b3 r14f1db0 49 49 DEVICE_MAP_DECLARE(packet_dimensions, packet_dimension_t); 50 50 51 extern int tl_get_ip_packet_dimension(int, packet_dimensions_ref, 52 device_id_t, packet_dimension_ref *); 53 51 54 /** Gets the address port. 52 55 * Supports AF_INET and AF_INET6 address families. … … 59 62 */ 60 63 extern int tl_get_address_port(const struct sockaddr * addr, int addrlen, uint16_t * port); 61 62 /** Gets IP packet dimensions.63 * Tries to search a cache and queries the IP module if not found.64 * The reply is cached then.65 * @param[in] ip_phone The IP moduel phone for (semi)remote calls.66 * @param[in] packet_dimensions The packet dimensions cache.67 * @param[in] device_id The device identifier.68 * @param[out] packet_dimension The IP packet dimensions.69 * @returns EOK on success.70 * @returns EBADMEM if the packet_dimension parameter is NULL.71 * @return ENOMEM if there is not enough memory left.72 * @returns EINVAL if the packet_dimensions cache is not valid.73 * @returns Other codes as defined for the ip_packet_size_req() function.74 */75 extern int tl_get_ip_packet_dimension(int ip_phone, packet_dimensions_ref packet_dimensions, device_id_t device_id, packet_dimension_ref * packet_dimension);76 64 77 65 /** Updates IP device packet dimensions cache. -
uspace/lib/net/include/tl_interface.h
r24ab58b3 r14f1db0 32 32 33 33 /** @file 34 * 34 * Transport layer module interface for the underlying internetwork layer. 35 35 */ 36 36 … … 48 48 49 49 /** @name Transport layer module interface 50 * 50 * This interface is used by other modules. 51 51 */ 52 52 /*@{*/ 53 53 54 /** Notifies the remote transport layer modules about the received packet/s. 55 * @param[in] tl_phone The transport layer module phone used for remote calls. 56 * @param[in] device_id The device identifier. 57 * @param[in] packet The received packet or the received packet queue. The packet queue is used to carry a~fragmented datagram. The first packet contains the headers, the others contain only data. 58 * @param[in] target The target transport layer module service to be delivered to. 59 * @param[in] error The packet error reporting service. Prefixes the received packet. 60 * @returns EOK on success. 54 /** Notify the remote transport layer modules about the received packet/s. 55 * 56 * @param[in] tl_phone The transport layer module phone used for remote calls. 57 * @param[in] device_id The device identifier. 58 * @param[in] packet The received packet or the received packet queue. 59 * The packet queue is used to carry a fragmented 60 * datagram. The first packet contains the headers, 61 * the others contain only data. 62 * @param[in] target The target transport layer module service to be 63 * delivered to. 64 * @param[in] error The packet error reporting service. Prefixes the 65 * received packet. 66 * 67 * @return EOK on success. 68 * 61 69 */ 62 inline static int tl_received_msg(int tl_phone, device_id_t device_id, packet_t packet, services_t target, services_t error){ 63 return generic_received_msg(tl_phone, NET_TL_RECEIVED, device_id, packet_get_id(packet), target, error); 70 inline static int tl_received_msg(int tl_phone, device_id_t device_id, 71 packet_t packet, services_t target, services_t error) 72 { 73 return generic_received_msg_remote(tl_phone, NET_TL_RECEIVED, device_id, 74 packet_get_id(packet), target, error); 64 75 } 65 76 -
uspace/lib/net/include/tl_local.h
r24ab58b3 r14f1db0 27 27 */ 28 28 29 /** @addtogroup nil_standalone29 /** @addtogroup tl_local 30 30 * @{ 31 31 */ 32 32 33 #ifndef __ NIL_STANDALONE_H__34 #define __ NIL_STANDALONE_H__33 #ifndef __TL_LOCAL_H__ 34 #define __TL_LOCAL_H__ 35 35 36 36 #include <ipc/ipc.h> 37 37 #include <async.h> 38 38 39 extern int nil_module_message(const char *,ipc_callid_t, ipc_call_t *,39 extern int tl_module_message_standalone(ipc_callid_t, ipc_call_t *, 40 40 ipc_call_t *, int *); 41 extern int nil_module_start(async_client_conn_t);41 extern int tl_module_start_standalone(async_client_conn_t); 42 42 43 43 #endif
Note:
See TracChangeset
for help on using the changeset viewer.