Changeset 357b5f5 in mainline for uspace/lib/net/include
- Timestamp:
- 2011-01-23T20:09:13Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fdb9982c
- Parents:
- cead2aa (diff), 7e36c8d (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. - Location:
- uspace/lib/net/include
- Files:
-
- 1 added
- 4 deleted
- 8 edited
- 6 moved
-
adt/module_map.h (modified) (1 diff)
-
arp_interface.h (modified) (1 diff)
-
generic.h (modified) (2 diffs)
-
icmp_header.h (modified) (3 diffs)
-
icmp_remote.h (moved) (moved from uspace/lib/net/include/icmp_interface.h ) (2 diffs)
-
il_local.h (deleted)
-
il_remote.h (moved) (moved from uspace/lib/net/include/il_interface.h ) (1 diff)
-
il_skel.h (moved) (moved from uspace/srv/net/tl/tcp/tcp_module.c ) (2 diffs)
-
net_interface.h (modified) (1 diff)
-
netif_interface.h (deleted)
-
netif_remote.h (modified) (1 diff)
-
netif_skel.h (moved) (moved from uspace/lib/net/include/netif_local.h ) (10 diffs)
-
nil_interface.h (deleted)
-
nil_local.h (deleted)
-
nil_remote.h (modified) (1 diff)
-
nil_skel.h (added)
-
socket_core.h (modified) (2 diffs)
-
tl_remote.h (moved) (moved from uspace/lib/net/include/tl_interface.h ) (2 diffs)
-
tl_skel.h (moved) (moved from uspace/lib/net/include/tl_local.h ) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/include/adt/module_map.h
rcead2aa r357b5f5 65 65 int usage; 66 66 /** Module name. */ 67 const char*name;67 const uint8_t *name; 68 68 /** Module full path filename. */ 69 const char*filename;69 const uint8_t *filename; 70 70 /** Connecting function. */ 71 71 connect_module_t *connect_module; 72 72 }; 73 73 74 extern int add_module(module_t **, modules_t *, const char *, const char*,75 services_t, task_id_t, connect_module_t *);76 extern module_t *get_running_module(modules_t *, char*);77 extern task_id_t spawn(const char*);74 extern int add_module(module_t **, modules_t *, const uint8_t *, 75 const uint8_t *, services_t, task_id_t, connect_module_t *); 76 extern module_t *get_running_module(modules_t *, uint8_t *); 77 extern task_id_t net_spawn(const uint8_t *); 78 78 79 79 #endif -
uspace/lib/net/include/arp_interface.h
rcead2aa r357b5f5 50 50 measured_string_t *); 51 51 extern int arp_translate_req(int, device_id_t, services_t, measured_string_t *, 52 measured_string_t **, char**);52 measured_string_t **, uint8_t **); 53 53 extern int arp_clear_device_req(int, device_id_t); 54 54 extern int arp_clear_address_req(int, device_id_t, services_t, -
uspace/lib/net/include/generic.h
rcead2aa r357b5f5 50 50 extern int generic_device_req_remote(int, int, device_id_t, int, services_t); 51 51 extern int generic_get_addr_req(int, int, device_id_t, measured_string_t **, 52 char**);52 uint8_t **); 53 53 extern int generic_packet_size_req_remote(int, int, device_id_t, 54 54 packet_dimension_t *); … … 58 58 services_t, services_t); 59 59 extern int generic_translate_req(int, int, device_id_t, services_t, 60 measured_string_t *, size_t, measured_string_t **, char**);60 measured_string_t *, size_t, measured_string_t **, uint8_t **); 61 61 62 62 #endif -
uspace/lib/net/include/icmp_header.h
rcead2aa r357b5f5 45 45 46 46 /** ICMP header size in bytes. */ 47 #define ICMP_HEADER_SIZE sizeof(icmp_header_t) 48 49 /** Type definition of the echo specific data. 50 * @see icmp_echo 51 */ 52 typedef struct icmp_echo icmp_echo_t; 47 #define ICMP_HEADER_SIZE sizeof(icmp_header_t) 53 48 54 49 /** Echo specific data. */ 55 struct icmp_echo {50 typedef struct icmp_echo { 56 51 /** Message idintifier. */ 57 52 icmp_param_t identifier; 58 53 /** Message sequence number. */ 59 54 icmp_param_t sequence_number; 60 } __attribute__ ((packed)); 61 62 /** Type definition of the internet control message header. 63 * @see icmp_header 64 */ 65 typedef struct icmp_header icmp_header_t; 55 } __attribute__((packed)) icmp_echo_t; 66 56 67 57 /** Internet control message header. */ 68 struct icmp_header {58 typedef struct icmp_header { 69 59 /** The type of the message. */ 70 60 uint8_t type; … … 83 73 */ 84 74 uint16_t checksum; 85 75 86 76 /** Message specific data. */ 87 77 union { 88 78 /** Echo specific data. */ 89 icmp_echo_t echo;79 icmp_echo_t echo; 90 80 /** Proposed gateway value. */ 91 81 in_addr_t gateway; … … 107 97 } param; 108 98 } un; 109 } __attribute__ ((packed));99 } __attribute__((packed)) icmp_header_t; 110 100 111 101 #endif -
uspace/lib/net/include/icmp_remote.h
rcead2aa r357b5f5 27 27 */ 28 28 29 /** @addtogroup libnet 29 /** @addtogroup libnet 30 30 * @{ 31 31 */ 32 32 33 #ifndef LIBNET_ICMP_ INTERFACE_H_34 #define LIBNET_ICMP_ INTERFACE_H_33 #ifndef LIBNET_ICMP_REMOTE_H_ 34 #define LIBNET_ICMP_REMOTE_H_ 35 35 36 36 #include <net/socket_codes.h> … … 54 54 extern int icmp_source_quench_msg(int, packet_t *); 55 55 extern int icmp_time_exceeded_msg(int, icmp_code_t, packet_t *); 56 extern int icmp_parameter_problem_msg(int, icmp_code_t, icmp_param_t, packet_t *); 56 extern int icmp_parameter_problem_msg(int, icmp_code_t, icmp_param_t, 57 packet_t *); 57 58 58 59 /*@}*/ -
uspace/lib/net/include/il_remote.h
rcead2aa r357b5f5 36 36 */ 37 37 38 #ifndef LIBNET_IL_ INTERFACE_H_39 #define LIBNET_IL_ INTERFACE_H_38 #ifndef LIBNET_IL_REMOTE_H_ 39 #define LIBNET_IL_REMOTE_H_ 40 40 41 41 #include <ipc/services.h> -
uspace/lib/net/include/il_skel.h
rcead2aa r357b5f5 1 1 /* 2 * Copyright (c) 20 08 Lukas Mejdrech2 * Copyright (c) 2010 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup tcp29 /** @addtogroup libnet 30 30 * @{ 31 31 */ 32 32 33 #ifndef LIBNET_IL_SKEL_H_ 34 #define LIBNET_IL_SKEL_H_ 35 33 36 /** @file 34 * TCP standalone module implementation. 35 * Contains skeleton module functions mapping. 36 * The functions are used by the module skeleton as module specific entry 37 * points. 38 * @see module.c 37 * Internetwork layer module skeleton. 38 * The skeleton has to be part of each internetwork layer module. 39 39 */ 40 40 41 #include "tcp.h"42 #include "tcp_module.h"43 44 41 #include <async.h> 45 #include <stdio.h> 46 #include <errno.h> 42 #include <fibril_synch.h> 47 43 #include <ipc/ipc.h> 48 44 #include <ipc/services.h> 49 45 50 #include < net/ip_protocols.h>51 #include <net/ modules.h>46 #include <adt/measured_strings.h> 47 #include <net/device.h> 52 48 #include <net/packet.h> 53 #include <net_interface.h>54 49 55 #include <ip_interface.h> 56 #include <tl_local.h> 50 /** Module initialization. 51 * 52 * This has to be implemented in user code. 53 * 54 * @param[in] net_phone Networking module phone. 55 * 56 * @return EOK on success. 57 * @return Other error codes as defined for each specific module 58 * initialize function. 59 * 60 */ 61 extern int il_initialize(int net_phone); 57 62 58 /** TCP module global data. */ 59 extern tcp_globals_t tcp_globals; 63 /** Process the internetwork layer module message. 64 * 65 * This has to be implemented in user code. 66 * 67 * @param[in] callid Message identifier. 68 * @param[in] call Message parameters. 69 * @param[out] answer Answer. 70 * @param[out] count Number of arguments of the answer. 71 * 72 * @return EOK on success. 73 * @return Other error codes as defined for each specific module. 74 * 75 */ 76 extern int il_module_message(ipc_callid_t callid, ipc_call_t *call, 77 ipc_call_t *answer, size_t *answer_count); 60 78 61 int tl_module_start_standalone(async_client_conn_t client_connection) 62 { 63 ipcarg_t phonehash; 64 int rc; 79 extern int il_module_start(int); 65 80 66 async_set_client_connection(client_connection); 67 tcp_globals.net_phone = net_connect_module(); 68 69 rc = pm_init(); 70 if (rc != EOK) 71 return rc; 72 73 rc = tcp_initialize(client_connection); 74 if (rc != EOK) 75 goto out; 76 77 rc = REGISTER_ME(SERVICE_TCP, &phonehash); 78 if (rc != EOK) 79 goto out; 80 81 async_manager(); 82 83 out: 84 pm_destroy(); 85 return rc; 86 } 87 88 int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call, 89 ipc_call_t *answer, int *answer_count) 90 { 91 return tcp_message_standalone(callid, call, answer, answer_count); 92 } 81 #endif 93 82 94 83 /** @} -
uspace/lib/net/include/net_interface.h
rcead2aa r357b5f5 45 45 46 46 extern int net_get_device_conf_req(int, device_id_t, measured_string_t **, 47 size_t, char**);48 extern int net_get_conf_req(int, measured_string_t **, size_t, char**);49 extern void net_free_settings(measured_string_t *, char*);47 size_t, uint8_t **); 48 extern int net_get_conf_req(int, measured_string_t **, size_t, uint8_t **); 49 extern void net_free_settings(measured_string_t *, uint8_t *); 50 50 extern int net_connect_module(void); 51 51 -
uspace/lib/net/include/netif_remote.h
rcead2aa r357b5f5 41 41 #include <net/packet.h> 42 42 43 extern int netif_get_addr_req _remote(int, device_id_t, measured_string_t **,44 char**);45 extern int netif_probe_req _remote(int, device_id_t, int, int);46 extern int netif_send_msg _remote(int, device_id_t, packet_t *, services_t);47 extern int netif_start_req _remote(int, device_id_t);48 extern int netif_stop_req _remote(int, device_id_t);49 extern int netif_stats_req _remote(int, device_id_t, device_stats_t *);50 extern int netif_bind_service _remote(services_t, device_id_t, services_t,43 extern int netif_get_addr_req(int, device_id_t, measured_string_t **, 44 uint8_t **); 45 extern int netif_probe_req(int, device_id_t, int, void *); 46 extern int netif_send_msg(int, device_id_t, packet_t *, services_t); 47 extern int netif_start_req(int, device_id_t); 48 extern int netif_stop_req(int, device_id_t); 49 extern int netif_stats_req(int, device_id_t, device_stats_t *); 50 extern int netif_bind_service(services_t, device_id_t, services_t, 51 51 async_client_conn_t); 52 52 -
uspace/lib/net/include/netif_skel.h
rcead2aa r357b5f5 36 36 */ 37 37 38 #ifndef NET_NETIF_ LOCAL_H_39 #define NET_NETIF_ LOCAL_H_38 #ifndef NET_NETIF_SKEL_H_ 39 #define NET_NETIF_SKEL_H_ 40 40 41 41 #include <async.h> … … 76 76 * 77 77 * This function has to be implemented in user code. 78 * 78 79 */ 79 80 extern int netif_initialize(void); … … 83 84 * This has to be implemented in user code. 84 85 * 85 * @param[in] device_id The device identifier. 86 * @param[in] irq The device interrupt number. 87 * @param[in] io The device input/output address. 88 * 89 * @return EOK on success. 90 * @return Other error codes as defined for the find_device() 91 * function. 92 * @return Other error codes as defined for the specific module 93 * message implementation. 94 */ 95 extern int netif_probe_message(device_id_t device_id, int irq, uintptr_t io); 86 * @param[in] device_id Device identifier. 87 * @param[in] irq Device interrupt number. 88 * @param[in] io Device input/output address. 89 * 90 * @return EOK on success. 91 * @return Other error codes as defined for the find_device() 92 * function. 93 * @return Other error codes as defined for the specific module 94 * message implementation. 95 * 96 */ 97 extern int netif_probe_message(device_id_t device_id, int irq, void *io); 96 98 97 99 /** Send the packet queue. … … 99 101 * This has to be implemented in user code. 100 102 * 101 * @param[in] device_id The device identifier. 102 * @param[in] packet The packet queue. 103 * @param[in] sender The sending module service. 104 * 105 * @return EOK on success. 106 * @return EFORWARD if the device is not active (in the 107 * NETIF_ACTIVE state). 108 * @return Other error codes as defined for the find_device() 109 * function. 110 * @return Other error codes as defined for the specific module 111 * message implementation. 103 * @param[in] device_id Device identifier. 104 * @param[in] packet Packet queue. 105 * @param[in] sender Sending module service. 106 * 107 * @return EOK on success. 108 * @return EFORWARD if the device is not active (in the 109 * NETIF_ACTIVE state). 110 * @return Other error codes as defined for the find_device() 111 * function. 112 * @return Other error codes as defined for the specific module 113 * message implementation. 114 * 112 115 */ 113 116 extern int netif_send_message(device_id_t device_id, packet_t *packet, … … 118 121 * This has to be implemented in user code. 119 122 * 120 * @param[in] device The device structure. 121 * 122 * @return EOK on success. 123 * @return Other error codes as defined for the find_device() 124 * function. 125 * @return Other error codes as defined for the specific module 126 * message implementation. 123 * @param[in] device Device structure. 124 * 125 * @return New network interface state (non-negative values). 126 * @return Other error codes as defined for the find_device() 127 * function. 128 * @return Other error codes as defined for the specific module 129 * message implementation. 130 131 * 127 132 */ 128 133 extern int netif_start_message(netif_device_t *device); … … 132 137 * This has to be implemented in user code. 133 138 * 134 * @param[in] device The device structure. 135 * 136 * @return EOK on success. 137 * @return Other error codes as defined for the find_device() 138 * function. 139 * @return Other error codes as defined for the specific module 140 * message implementation. 139 * @param[in] device Device structure. 140 * 141 * @return EOK on success. 142 * @return Other error codes as defined for the find_device() 143 * function. 144 * @return Other error codes as defined for the specific module 145 * message implementation. 146 * 141 147 */ 142 148 extern int netif_stop_message(netif_device_t *device); … … 146 152 * This has to be implemented in user code. 147 153 * 148 * @param[in] device_id The device identifier. 149 * @param[out] address The device local hardware address. 150 * 151 * @return EOK on success. 152 * @return EBADMEM if the address parameter is NULL. 153 * @return ENOENT if there no such device. 154 * @return Other error codes as defined for the find_device() 155 * function. 156 * @return Other error codes as defined for the specific module 157 * message implementation. 154 * @param[in] device_id Device identifier. 155 * @param[out] address Device local hardware address. 156 * 157 * @return EOK on success. 158 * @return EBADMEM if the address parameter is NULL. 159 * @return ENOENT if there no such device. 160 * @return Other error codes as defined for the find_device() 161 * function. 162 * @return Other error codes as defined for the specific module 163 * message implementation. 164 * 158 165 */ 159 166 extern int netif_get_addr_message(device_id_t device_id, … … 165 172 * skeleton. This has to be implemented in user code. 166 173 * 167 * @param[in] callid The message identifier.168 * @param[in] call The message parameters.169 * @param[out] answer The message answer parameters.170 * @param[out] answer_count The last parameter for the actual answer in171 * the answer parameter.172 * 173 * @return EOK on success.174 * @return ENOTSUP if the message is not known.175 * @return Other error codes as defined for the specific module176 * message implementation.174 * @param[in] callid Message identifier. 175 * @param[in] call Message. 176 * @param[out] answer Answer. 177 * @param[out] count Number of answer arguments. 178 * 179 * @return EOK on success. 180 * @return ENOTSUP if the message is not known. 181 * @return Other error codes as defined for the specific module 182 * message implementation. 183 * 177 184 */ 178 185 extern int netif_specific_message(ipc_callid_t callid, ipc_call_t *call, 179 ipc_call_t *answer, int *answer_count);186 ipc_call_t *answer, size_t *count); 180 187 181 188 /** Return the device usage statistics. … … 183 190 * This has to be implemented in user code. 184 191 * 185 * @param[in] device_id The device identifier. 186 * @param[out] stats The device usage statistics. 187 * 188 * @return EOK on success. 189 * @return Other error codes as defined for the find_device() 190 * function. 191 * @return Other error codes as defined for the specific module 192 * message implementation. 192 * @param[in] device_id Device identifier. 193 * @param[out] stats Device usage statistics. 194 * 195 * @return EOK on success. 196 * @return Other error codes as defined for the find_device() 197 * function. 198 * @return Other error codes as defined for the specific module 199 * message implementation. 200 * 193 201 */ 194 202 extern int netif_get_device_stats(device_id_t device_id, 195 203 device_stats_t *stats); 196 197 extern int netif_get_addr_req_local(int, device_id_t, measured_string_t **,198 char **);199 extern int netif_probe_req_local(int, device_id_t, int, int);200 extern int netif_send_msg_local(int, device_id_t, packet_t *, services_t);201 extern int netif_start_req_local(int, device_id_t);202 extern int netif_stop_req_local(int, device_id_t);203 extern int netif_stats_req_local(int, device_id_t, device_stats_t *);204 extern int netif_bind_service_local(services_t, device_id_t, services_t,205 async_client_conn_t);206 204 207 205 extern int find_device(device_id_t, netif_device_t **); … … 209 207 extern void netif_pq_release(packet_id_t); 210 208 extern packet_t *netif_packet_get_1(size_t); 211 extern int netif_init_module(async_client_conn_t); 212 213 extern int netif_module_message_standalone(const char *, ipc_callid_t, 214 ipc_call_t *, ipc_call_t *, int *); 215 extern int netif_module_start_standalone(async_client_conn_t); 209 210 extern int netif_module_start(void); 216 211 217 212 #endif -
uspace/lib/net/include/nil_remote.h
rcead2aa r357b5f5 37 37 #include <net/device.h> 38 38 #include <net/packet.h> 39 #include <generic.h> 39 40 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); 41 #define nil_bind_service(service, device_id, me, receiver) \ 42 bind_service(service, device_id, me, 0, receiver) 43 44 #define nil_packet_size_req(nil_phone, device_id, packet_dimension) \ 45 generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, \ 46 device_id, packet_dimension) 47 48 #define nil_get_addr_req(nil_phone, device_id, address, data) \ 49 generic_get_addr_req(nil_phone, NET_NIL_ADDR, device_id, address, data) 50 51 #define nil_get_broadcast_addr_req(nil_phone, device_id, address, data) \ 52 generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, \ 53 address, data) 54 55 #define nil_send_msg(nil_phone, device_id, packet, sender) \ 56 generic_send_msg_remote(nil_phone, NET_NIL_SEND, device_id, \ 57 packet_get_id(packet), sender, 0) 58 59 #define nil_device_req(nil_phone, device_id, mtu, netif_service) \ 60 generic_device_req_remote(nil_phone, NET_NIL_DEVICE, device_id, mtu, \ 61 netif_service) 62 63 extern int nil_device_state_msg(int, device_id_t, int); 64 extern int nil_received_msg(int, device_id_t, packet_t *, services_t); 42 65 43 66 #endif -
uspace/lib/net/include/socket_core.h
rcead2aa r357b5f5 86 86 void *specific_data; 87 87 /** Socket ports map key. */ 88 const char*key;88 const uint8_t *key; 89 89 /** Length of the Socket ports map key. */ 90 90 size_t key_length; … … 118 118 void (*)(socket_core_t *)); 119 119 extern int socket_reply_packets(packet_t *, size_t *); 120 extern socket_core_t *socket_port_find(socket_ports_t *, int, const char*,120 extern socket_core_t *socket_port_find(socket_ports_t *, int, const uint8_t *, 121 121 size_t); 122 122 extern void socket_port_release(socket_ports_t *, socket_core_t *); 123 123 extern int socket_port_add(socket_ports_t *, int, socket_core_t *, 124 const char*, size_t);124 const uint8_t *, size_t); 125 125 126 126 #endif -
uspace/lib/net/include/tl_remote.h
rcead2aa r357b5f5 35 35 */ 36 36 37 #ifndef LIBNET_TL_ INTERFACE_H_38 #define LIBNET_TL_ INTERFACE_H_37 #ifndef LIBNET_TL_REMOTE_H_ 38 #define LIBNET_TL_REMOTE_H_ 39 39 40 40 #include <async.h> … … 52 52 /*@{*/ 53 53 54 extern int tl_received_msg(int, device_id_t, packet_t *, services_t, services_t); 54 extern int tl_received_msg(int, device_id_t, packet_t *, services_t, 55 services_t); 55 56 56 57 /*@}*/ -
uspace/lib/net/include/tl_skel.h
rcead2aa r357b5f5 31 31 */ 32 32 33 #ifndef LIBNET_TL_ LOCAL_H_34 #define LIBNET_TL_ LOCAL_H_33 #ifndef LIBNET_TL_SKEL_H_ 34 #define LIBNET_TL_SKEL_H_ 35 35 36 /** @file 37 * Transport layer module skeleton. 38 * The skeleton has to be part of each transport layer module. 39 */ 40 41 #include <async.h> 42 #include <fibril_synch.h> 36 43 #include <ipc/ipc.h> 37 #include < async.h>44 #include <ipc/services.h> 38 45 39 /** Starts the TL module. 46 #include <adt/measured_strings.h> 47 #include <net/device.h> 48 #include <net/packet.h> 49 50 /** Module initialization. 40 51 * 41 * Initializes the client connection serving function, initializes the module, 42 * registers the module service and starts the async manager, processing IPC 43 * messages in an infinite loop. 52 * This has to be implemented in user code. 44 53 * 45 * @param[in] client_connection The client connection processing function. The 46 * module skeleton propagates its own one. 47 * @return EOK on successful module termination. 48 * @return Other error codes as defined for the module initialize 49 * function. 50 * @return Other error codes as defined for the REGISTER_ME() macro 51 * function. 54 * @param[in] net_phone Networking module phone. 55 * 56 * @return EOK on success. 57 * @return Other error codes as defined for each specific module 58 * initialize function. 59 * 52 60 */ 53 extern int tl_module_message_standalone(ipc_callid_t, ipc_call_t *, 54 ipc_call_t *, int *); 61 extern int tl_initialize(int net_phone); 55 62 63 /** Per-connection module initialization. 64 * 65 * This has to be implemented in user code. 66 * 67 */ 68 extern void tl_connection(void); 56 69 57 /** Process es the TLmodule message.70 /** Process the transport layer module message. 58 71 * 59 * @param[in] callid The message identifier. 60 * @param[in] call The message parameters. 61 * @param[out] answer The message answer parameters. 62 * @param[out] answer_count The last parameter for the actual answer in the 63 * answer parameter. 64 * @return EOK on success. 65 * @return Other error codes as defined for the module's message 66 * standalone function. 72 * This has to be implemented in user code. 73 * 74 * @param[in] callid Message identifier. 75 * @param[in] call Message parameters. 76 * @param[out] answer Answer. 77 * @param[out] count Number of arguments of the answer. 78 * 79 * @return EOK on success. 80 * @return Other error codes as defined for each specific module. 81 * 67 82 */ 68 extern int tl_module_start_standalone(async_client_conn_t); 83 extern int tl_message(ipc_callid_t, ipc_call_t *, 84 ipc_call_t *, size_t *); 85 86 extern int tl_module_start(int); 69 87 70 88 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
