Changeset 80cd7cd in mainline for uspace/lib/net
- Timestamp:
- 2011-01-13T20:58:24Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 87e373b
- Parents:
- eaef141 (diff), a613fea1 (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
- Files:
-
- 5 added
- 5 deleted
- 18 edited
- 7 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/Makefile
reaef141 r80cd7cd 40 40 generic/protocol_map.c \ 41 41 adt/module_map.c \ 42 netif/netif_local.c \43 42 netif/netif_remote.c \ 43 netif/netif_skel.c \ 44 44 nil/nil_remote.c \ 45 il/il_interface.c \ 45 nil/nil_skel.c \ 46 il/il_remote.c \ 47 il/il_skel.c \ 46 48 il/ip_remote.c \ 47 49 il/ip_client.c \ … … 50 52 tl/icmp_client.c \ 51 53 tl/socket_core.c \ 52 tl/tl_interface.c \ 53 tl/tl_common.c 54 tl/tl_common.c \ 55 tl/tl_remote.c \ 56 tl/tl_skel.c 54 57 55 58 include $(USPACE_PREFIX)/Makefile.common -
uspace/lib/net/adt/module_map.c
reaef141 r80cd7cd 63 63 */ 64 64 int 65 add_module(module_t **module, modules_t *modules, const char*name,66 const char*filename, services_t service, task_id_t task_id,65 add_module(module_t **module, modules_t *modules, const uint8_t *name, 66 const uint8_t *filename, services_t service, task_id_t task_id, 67 67 connect_module_t connect_module) 68 68 { … … 104 104 * @return NULL if there is no such module. 105 105 */ 106 module_t *get_running_module(modules_t *modules, char*name)106 module_t *get_running_module(modules_t *modules, uint8_t *name) 107 107 { 108 108 module_t *module; … … 113 113 114 114 if (!module->task_id) { 115 module->task_id = spawn(module->filename);115 module->task_id = net_spawn(module->filename); 116 116 if (!module->task_id) 117 117 return NULL; … … 123 123 } 124 124 125 /** Start sthe given module.125 /** Start the given module. 126 126 * 127 * @param[in] fname The module full or relative path filename. 128 * @return The new module task identifier on success. 129 * @return Zero if there is no such module. 127 * @param[in] fname The module full or relative path filename. 128 * 129 * @return The new module task identifier on success. 130 * @return Zero if there is no such module. 131 * 130 132 */ 131 task_id_t spawn(const char*fname)133 task_id_t net_spawn(const uint8_t *fname) 132 134 { 133 135 task_id_t id; 134 136 int rc; 135 137 136 rc = task_spawnl(&id, fname,fname, NULL);138 rc = task_spawnl(&id, (const char *) fname, (const char *) fname, NULL); 137 139 if (rc != EOK) 138 140 return 0; -
uspace/lib/net/generic/generic.c
reaef141 r80cd7cd 100 100 int 101 101 generic_get_addr_req(int phone, int message, device_id_t device_id, 102 measured_string_t **address, char **data)102 measured_string_t **address, uint8_t **data) 103 103 { 104 104 aid_t message_id; … … 234 234 generic_translate_req(int phone, int message, device_id_t device_id, 235 235 services_t service, measured_string_t *configuration, size_t count, 236 measured_string_t **translation, char**data)236 measured_string_t **translation, uint8_t **data) 237 237 { 238 238 aid_t message_id; -
uspace/lib/net/generic/net_remote.c
reaef141 r80cd7cd 63 63 * @see net_get_conf_req() 64 64 */ 65 void net_free_settings(measured_string_t *settings, char*data)65 void net_free_settings(measured_string_t *settings, uint8_t *data) 66 66 { 67 67 if (settings) … … 91 91 int 92 92 net_get_conf_req(int net_phone, measured_string_t **configuration, 93 size_t count, char**data)93 size_t count, uint8_t **data) 94 94 { 95 95 return generic_translate_req(net_phone, NET_NET_GET_DEVICE_CONF, 0, 0, … … 118 118 int 119 119 net_get_device_conf_req(int net_phone, device_id_t device_id, 120 measured_string_t **configuration, size_t count, char**data)120 measured_string_t **configuration, size_t count, uint8_t **data) 121 121 { 122 122 return generic_translate_req(net_phone, NET_NET_GET_DEVICE_CONF, -
uspace/lib/net/generic/protocol_map.c
reaef141 r80cd7cd 50 50 switch (nil) { 51 51 case SERVICE_ETHERNET: 52 case SERVICE_ DP8390:52 case SERVICE_NE2000: 53 53 switch (il) { 54 54 case SERVICE_IP: … … 76 76 switch (nil) { 77 77 case SERVICE_ETHERNET: 78 case SERVICE_ DP8390:78 case SERVICE_NE2000: 79 79 switch (protocol) { 80 80 case ETH_P_IP: … … 139 139 switch (nil) { 140 140 case SERVICE_ETHERNET: 141 case SERVICE_ DP8390:141 case SERVICE_NE2000: 142 142 return HW_ETHER; 143 143 default: -
uspace/lib/net/il/arp_remote.c
reaef141 r80cd7cd 165 165 int 166 166 arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol, 167 measured_string_t *address, measured_string_t **translation, char**data)167 measured_string_t *address, measured_string_t **translation, uint8_t **data) 168 168 { 169 169 return generic_translate_req(arp_phone, NET_ARP_TRANSLATE, device_id, -
uspace/lib/net/il/il_remote.c
reaef141 r80cd7cd 33 33 /** @file 34 34 * Internetwork layer module interface for the underlying network interface 35 * layer. This interface is always called by the remote modules.35 * layer. 36 36 */ 37 37 38 #include <il_ interface.h>38 #include <il_remote.h> 39 39 #include <generic.h> 40 40 #include <packet_client.h> -
uspace/lib/net/il/ip_remote.c
reaef141 r80cd7cd 36 36 * 37 37 * @see ip_interface.h 38 * @see il_ interface.h38 * @see il_remote.h 39 39 * 40 40 */ … … 121 121 services_t service) 122 122 { 123 return generic_device_req_remote(ip_phone, NET_I L_DEVICE, device_id, 0,123 return generic_device_req_remote(ip_phone, NET_IP_DEVICE, device_id, 0, 124 124 service); 125 125 } … … 170 170 free(*header); 171 171 else 172 *device_id = IPC_GET_DEVICE( &answer);172 *device_id = IPC_GET_DEVICE(answer); 173 173 174 174 return (int) result; … … 188 188 packet_dimension_t *packet_dimension) 189 189 { 190 return generic_packet_size_req_remote(ip_phone, NET_I L_PACKET_SPACE,190 return generic_packet_size_req_remote(ip_phone, NET_IP_PACKET_SPACE, 191 191 device_id, packet_dimension); 192 192 } … … 228 228 services_t sender, services_t error) 229 229 { 230 return generic_send_msg_remote(ip_phone, NET_I L_SEND, device_id,230 return generic_send_msg_remote(ip_phone, NET_IP_SEND, device_id, 231 231 packet_get_id(packet), sender, error); 232 232 } -
uspace/lib/net/include/adt/module_map.h
reaef141 r80cd7cd 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
reaef141 r80cd7cd 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
reaef141 r80cd7cd 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/il_remote.h
reaef141 r80cd7cd 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
reaef141 r80cd7cd 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 sysarg_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 = ipc_connect_to_me(PHONE_NS, SERVICE_TCP, 0, 0, &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
reaef141 r80cd7cd 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
reaef141 r80cd7cd 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
reaef141 r80cd7cd 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
reaef141 r80cd7cd 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
reaef141 r80cd7cd 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
reaef141 r80cd7cd 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/netif/netif_remote.c
reaef141 r80cd7cd 27 27 */ 28 28 29 /** @addtogroup libnet 29 /** @addtogroup libnet 30 30 * @{ 31 31 */ … … 49 49 /** Return the device local hardware address. 50 50 * 51 * @param[in] netif_phone The network interface phone. 52 * @param[in] device_id The device identifier. 53 * @param[out] address The device local hardware address. 54 * @param[out] data The address data. 55 * @return EOK on success. 56 * @return EBADMEM if the address parameter is NULL. 57 * @return ENOENT if there no such device. 58 * @return Other error codes as defined for the 59 * netif_get_addr_message() function. 51 * @param[in] netif_phone Network interface phone. 52 * @param[in] device_id Device identifier. 53 * @param[out] address Device local hardware address. 54 * @param[out] data Address data. 55 * 56 * @return EOK on success. 57 * @return EBADMEM if the address parameter is NULL. 58 * @return ENOENT if there no such device. 59 * @return Other error codes as defined for the 60 * netif_get_addr_message() function. 61 * 60 62 */ 61 int netif_get_addr_req _remote(int netif_phone, device_id_t device_id,62 measured_string_t **address, char**data)63 int netif_get_addr_req(int netif_phone, device_id_t device_id, 64 measured_string_t **address, uint8_t **data) 63 65 { 64 66 return generic_get_addr_req(netif_phone, NET_NETIF_GET_ADDR, device_id, … … 68 70 /** Probe the existence of the device. 69 71 * 70 * @param[in] netif_phone The network interface phone. 71 * @param[in] device_id The device identifier. 72 * @param[in] irq The device interrupt number. 73 * @param[in] io The device input/output address. 74 * @return EOK on success. 75 * @return Other error codes as defined for the 76 * netif_probe_message(). 72 * @param[in] netif_phone Network interface phone. 73 * @param[in] device_id Device identifier. 74 * @param[in] irq Device interrupt number. 75 * @param[in] io Device input/output address. 76 * 77 * @return EOK on success. 78 * @return Other error codes as defined for the 79 * netif_probe_message(). 80 * 77 81 */ 78 int 79 netif_probe_req_remote(int netif_phone, device_id_t device_id, int irq, int io) 82 int netif_probe_req(int netif_phone, device_id_t device_id, int irq, void *io) 80 83 { 81 return async_req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq, io); 84 return async_req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq, 85 (sysarg_t) io); 82 86 } 83 87 84 88 /** Send the packet queue. 85 89 * 86 * @param[in] netif_phone The network interface phone. 87 * @param[in] device_id The device identifier. 88 * @param[in] packet The packet queue. 89 * @param[in] sender The sending module service. 90 * @return EOK on success. 91 * @return Other error codes as defined for the generic_send_msg() 92 * function. 90 * @param[in] netif_phone Network interface phone. 91 * @param[in] device_id Device identifier. 92 * @param[in] packet Packet queue. 93 * @param[in] sender Sending module service. 94 * 95 * @return EOK on success. 96 * @return Other error codes as defined for the generic_send_msg() 97 * function. 98 * 93 99 */ 94 int 95 netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t *packet, 100 int netif_send_msg(int netif_phone, device_id_t device_id, packet_t *packet, 96 101 services_t sender) 97 102 { … … 102 107 /** Start the device. 103 108 * 104 * @param[in] netif_phone The network interface phone. 105 * @param[in] device_id The device identifier. 106 * @return EOK on success. 107 * @return Other error codes as defined for the find_device() 108 * function. 109 * @return Other error codes as defined for the 110 * netif_start_message() function. 109 * @param[in] netif_phone Network interface phone. 110 * @param[in] device_id Device identifier. 111 * 112 * @return EOK on success. 113 * @return Other error codes as defined for the find_device() 114 * function. 115 * @return Other error codes as defined for the 116 * netif_start_message() function. 117 * 111 118 */ 112 int netif_start_req _remote(int netif_phone, device_id_t device_id)119 int netif_start_req(int netif_phone, device_id_t device_id) 113 120 { 114 121 return async_req_1_0(netif_phone, NET_NETIF_START, device_id); … … 117 124 /** Stop the device. 118 125 * 119 * @param[in] netif_phone The network interface phone. 120 * @param[in] device_id The device identifier. 121 * @return EOK on success. 122 * @return Other error codes as defined for the find_device() 123 * function. 124 * @return Other error codes as defined for the 125 * netif_stop_message() function. 126 * @param[in] netif_phone Network interface phone. 127 * @param[in] device_id Device identifier. 128 * 129 * @return EOK on success. 130 * @return Other error codes as defined for the find_device() 131 * function. 132 * @return Other error codes as defined for the 133 * netif_stop_message() function. 134 * 126 135 */ 127 int netif_stop_req _remote(int netif_phone, device_id_t device_id)136 int netif_stop_req(int netif_phone, device_id_t device_id) 128 137 { 129 138 return async_req_1_0(netif_phone, NET_NETIF_STOP, device_id); … … 132 141 /** Return the device usage statistics. 133 142 * 134 * @param[in] netif_phone The network interface phone. 135 * @param[in] device_id The device identifier. 136 * @param[out] stats The device usage statistics. 143 * @param[in] netif_phone Network interface phone. 144 * @param[in] device_id Device identifier. 145 * @param[out] stats Device usage statistics. 146 * 137 147 * @return EOK on success. 148 * 138 149 */ 139 int netif_stats_req _remote(int netif_phone, device_id_t device_id,150 int netif_stats_req(int netif_phone, device_id_t device_id, 140 151 device_stats_t *stats) 141 152 { … … 153 164 } 154 165 155 /** Create bidirectional connection with the network interface module and 156 * registers the message receiver. 166 /** Create bidirectional connection with the network interface module 167 * 168 * Create bidirectional connection with the network interface module and 169 * register the message receiver. 157 170 * 158 171 * @param[in] service The network interface module service. … … 161 174 * @param[in] receiver The message receiver. 162 175 * 163 * @return The phone of the needed service. 164 * @return EOK on success. 165 * @return Other error codes as defined for the bind_service() 166 * function. 176 * @return The phone of the needed service. 177 * @return EOK on success. 178 * @return Other error codes as defined for the bind_service() 179 * function. 180 * 167 181 */ 168 int 169 netif_bind_service_remote(services_t service, device_id_t device_id, 182 int netif_bind_service(services_t service, device_id_t device_id, 170 183 services_t me, async_client_conn_t receiver) 171 184 { -
uspace/lib/net/netif/netif_skel.c
reaef141 r80cd7cd 27 27 */ 28 28 29 /** @addtogroup libnet 29 /** @addtogroup libnet 30 30 * @{ 31 31 */ … … 33 33 /** @file 34 34 * Network interface module skeleton implementation. 35 * @see netif .h35 * @see netif_skel.h 36 36 */ 37 37 … … 52 52 #include <adt/measured_strings.h> 53 53 #include <net/device.h> 54 #include <nil_interface.h> 55 #include <netif_local.h> 56 #include <netif_interface.h> 54 #include <netif_skel.h> 55 #include <nil_remote.h> 57 56 58 57 DEVICE_MAP_IMPLEMENT(netif_device_map, netif_device_t); … … 63 62 /** Probe the existence of the device. 64 63 * 65 * @param[in] netif_phone The network interface phone. 66 * @param[in] device_id The device identifier. 67 * @param[in] irq The device interrupt number. 68 * @param[in] io The device input/output address. 69 * @return EOK on success. 70 * @return Other error codes as defined for the 71 * netif_probe_message(). 72 */ 73 int 74 netif_probe_req_local(int netif_phone, device_id_t device_id, int irq, int io) 64 * @param[in] netif_phone Network interface phone. 65 * @param[in] device_id Device identifier. 66 * @param[in] irq Device interrupt number. 67 * @param[in] io Device input/output address. 68 * 69 * @return EOK on success. 70 * @return Other error codes as defined for the 71 * netif_probe_message(). 72 * 73 */ 74 static int netif_probe_req_local(int netif_phone, device_id_t device_id, 75 int irq, void *io) 75 76 { 76 77 fibril_rwlock_write_lock(&netif_globals.lock); … … 83 84 /** Send the packet queue. 84 85 * 85 * @param[in] netif_phone The network interface phone. 86 * @param[in] device_id The device identifier. 87 * @param[in] packet The packet queue. 88 * @param[in] sender The sending module service. 89 * @return EOK on success. 90 * @return Other error codes as defined for the generic_send_msg() 91 * function. 92 */ 93 int netif_send_msg_local(int netif_phone, device_id_t device_id, 86 * @param[in] netif_phone Network interface phone. 87 * @param[in] device_id Device identifier. 88 * @param[in] packet Packet queue. 89 * @param[in] sender Sending module service. 90 * 91 * @return EOK on success. 92 * @return Other error codes as defined for the generic_send_msg() 93 * function. 94 * 95 */ 96 static int netif_send_msg_local(int netif_phone, device_id_t device_id, 94 97 packet_t *packet, services_t sender) 95 98 { … … 103 106 /** Start the device. 104 107 * 105 * @param[in] netif_phone The network interface phone.106 * @param[in] device_id The device identifier.107 * @return EOK on success.108 * @return Other error codes as defined for the find_device()109 * function.110 * @return Other error codes as defined for the111 * netif_start_message() function.112 * /113 int netif_start_req_local(int netif_phone, device_id_t device_id) 114 { 115 int rc; 116 108 * @param[in] netif_phone Network interface phone. 109 * @param[in] device_id Device identifier. 110 * 111 * @return EOK on success. 112 * @return Other error codes as defined for the find_device() 113 * function. 114 * @return Other error codes as defined for the 115 * netif_start_message() function. 116 * 117 */ 118 static int netif_start_req_local(int netif_phone, device_id_t device_id) 119 { 117 120 fibril_rwlock_write_lock(&netif_globals.lock); 118 121 119 122 netif_device_t *device; 120 rc = find_device(device_id, &device);123 int rc = find_device(device_id, &device); 121 124 if (rc != EOK) { 122 125 fibril_rwlock_write_unlock(&netif_globals.lock); … … 127 130 if (result > NETIF_NULL) { 128 131 int phone = device->nil_phone; 132 nil_device_state_msg(phone, device_id, result); 129 133 fibril_rwlock_write_unlock(&netif_globals.lock); 130 nil_device_state_msg(phone, device_id, result);131 134 return EOK; 132 135 } … … 139 142 /** Stop the device. 140 143 * 141 * @param[in] netif_phone The network interface phone.142 * @param[in] device_id The device identifier.143 * @return EOK on success.144 * @return Other error codes as defined for the find_device()145 * function.146 * @return Other error codes as defined for the147 * netif_stop_message() function.148 * /149 int netif_stop_req_local(int netif_phone, device_id_t device_id) 150 { 151 int rc; 152 144 * @param[in] netif_phone Network interface phone. 145 * @param[in] device_id Device identifier. 146 * 147 * @return EOK on success. 148 * @return Other error codes as defined for the find_device() 149 * function. 150 * @return Other error codes as defined for the 151 * netif_stop_message() function. 152 * 153 */ 154 static int netif_stop_req_local(int netif_phone, device_id_t device_id) 155 { 153 156 fibril_rwlock_write_lock(&netif_globals.lock); 154 157 155 158 netif_device_t *device; 156 rc = find_device(device_id, &device);159 int rc = find_device(device_id, &device); 157 160 if (rc != EOK) { 158 161 fibril_rwlock_write_unlock(&netif_globals.lock); … … 163 166 if (result > NETIF_NULL) { 164 167 int phone = device->nil_phone; 168 nil_device_state_msg(phone, device_id, result); 165 169 fibril_rwlock_write_unlock(&netif_globals.lock); 166 nil_device_state_msg(phone, device_id, result);167 170 return EOK; 168 171 } … … 173 176 } 174 177 175 /** Return the device usage statistics.176 *177 * @param[in] netif_phone The network interface phone.178 * @param[in] device_id The device identifier.179 * @param[out] stats The device usage statistics.180 * @return EOK on success.181 */182 int netif_stats_req_local(int netif_phone, device_id_t device_id,183 device_stats_t *stats)184 {185 fibril_rwlock_read_lock(&netif_globals.lock);186 int res = netif_get_device_stats(device_id, stats);187 fibril_rwlock_read_unlock(&netif_globals.lock);188 189 return res;190 }191 192 /** Return the device local hardware address.193 *194 * @param[in] netif_phone The network interface phone.195 * @param[in] device_id The device identifier.196 * @param[out] address The device local hardware address.197 * @param[out] data The address data.198 * @return EOK on success.199 * @return EBADMEM if the address parameter is NULL.200 * @return ENOENT if there no such device.201 * @return Other error codes as defined for the202 * netif_get_addr_message() function.203 */204 int netif_get_addr_req_local(int netif_phone, device_id_t device_id,205 measured_string_t **address, char **data)206 {207 int rc;208 209 if (!address || !data)210 return EBADMEM;211 212 fibril_rwlock_read_lock(&netif_globals.lock);213 214 measured_string_t translation;215 rc = netif_get_addr_message(device_id, &translation);216 if (rc == EOK) {217 *address = measured_string_copy(&translation);218 rc = (*address) ? EOK : ENOMEM;219 }220 221 fibril_rwlock_read_unlock(&netif_globals.lock);222 223 *data = (**address).value;224 225 return rc;226 }227 228 178 /** Find the device specific data. 229 179 * 230 * @param[in] device_id The device identifier. 231 * @param[out] device The device specific data. 232 * @return EOK on success. 233 * @return ENOENT if device is not found. 234 * @return EPERM if the device is not initialized. 180 * @param[in] device_id Device identifier. 181 * @param[out] device Device specific data. 182 * 183 * @return EOK on success. 184 * @return ENOENT if device is not found. 185 * @return EPERM if the device is not initialized. 186 * 235 187 */ 236 188 int find_device(device_id_t device_id, netif_device_t **device) … … 251 203 /** Clear the usage statistics. 252 204 * 253 * @param[in] stats The usage statistics. 205 * @param[in] stats The usage statistics. 206 * 254 207 */ 255 208 void null_device_stats(device_stats_t *stats) … … 258 211 } 259 212 260 /** Initialize the netif module. 261 * 262 * @param[in] client_connection The client connection functio to be registered. 263 * @return EOK on success. 264 * @return Other error codes as defined for each specific module 265 * message function. 266 */ 267 int netif_init_module(async_client_conn_t client_connection) 268 { 269 int rc; 270 271 async_set_client_connection(client_connection); 272 273 netif_globals.net_phone = connect_to_service(SERVICE_NETWORKING); 274 netif_device_map_initialize(&netif_globals.device_map); 275 276 rc = pm_init(); 213 /** Release the given packet. 214 * 215 * Prepared for future optimization. 216 * 217 * @param[in] packet_id The packet identifier. 218 * 219 */ 220 void netif_pq_release(packet_id_t packet_id) 221 { 222 pq_release_remote(netif_globals.net_phone, packet_id); 223 } 224 225 /** Allocate new packet to handle the given content size. 226 * 227 * @param[in] content Minimum content size. 228 * 229 * @return The allocated packet. 230 * @return NULL on error. 231 * 232 */ 233 packet_t *netif_packet_get_1(size_t content) 234 { 235 return packet_get_1_remote(netif_globals.net_phone, content); 236 } 237 238 /** Register the device notification receiver, 239 * 240 * Register a network interface layer module as the device 241 * notification receiver. 242 * 243 * @param[in] device_id Device identifier. 244 * @param[in] phone Network interface layer module phone. 245 * 246 * @return EOK on success. 247 * @return ENOENT if there is no such device. 248 * @return ELIMIT if there is another module registered. 249 * 250 */ 251 static int register_message(device_id_t device_id, int phone) 252 { 253 netif_device_t *device; 254 int rc = find_device(device_id, &device); 277 255 if (rc != EOK) 278 256 return rc; 279 257 280 fibril_rwlock_initialize(&netif_globals.lock); 281 282 rc = netif_initialize(); 283 if (rc != EOK) { 284 pm_destroy(); 285 return rc; 286 } 287 258 if (device->nil_phone >= 0) 259 return ELIMIT; 260 261 device->nil_phone = phone; 288 262 return EOK; 289 263 } 290 264 291 /** Release the given packet.292 *293 * Prepared for future optimization.294 *295 * @param[in] packet_id The packet identifier.296 */297 void netif_pq_release(packet_id_t packet_id)298 {299 pq_release_remote(netif_globals.net_phone, packet_id);300 }301 302 /** Allocate new packet to handle the given content size.303 *304 * @param[in] content The minimum content size.305 * @return The allocated packet.306 * @return NULL if there is an error.307 *308 */309 packet_t *netif_packet_get_1(size_t content)310 {311 return packet_get_1_remote(netif_globals.net_phone, content);312 }313 314 /** Register the device notification receiver, the network interface layer315 * module.316 *317 * @param[in] name Module name.318 * @param[in] device_id The device identifier.319 * @param[in] phone The network interface layer module phone.320 * @return EOK on success.321 * @return ENOENT if there is no such device.322 * @return ELIMIT if there is another module registered.323 */324 static int register_message(const char *name, device_id_t device_id, int phone)325 {326 netif_device_t *device;327 int rc;328 329 rc = find_device(device_id, &device);330 if (rc != EOK)331 return rc;332 333 if (device->nil_phone > 0)334 return ELIMIT;335 336 device->nil_phone = phone;337 printf("%s: Receiver of device %d registered (phone: %d)\n",338 name, device->device_id, device->nil_phone);339 return EOK;340 }341 342 265 /** Process the netif module messages. 343 266 * 344 * @param[in] name Module name. 345 * @param[in] callid The message identifier. 346 * @param[in] call The message parameters. 347 * @param[out] answer The message answer parameters. 348 * @param[out] answer_count The last parameter for the actual answer in the 349 * answer parameter. 350 * @return EOK on success. 351 * @return ENOTSUP if the message is not known. 352 * @return Other error codes as defined for each specific module 353 * message function. 267 * @param[in] callid Mmessage identifier. 268 * @param[in] call Message. 269 * @param[out] answer Answer. 270 * @param[out] count Number of arguments of the answer. 271 * 272 * @return EOK on success. 273 * @return ENOTSUP if the message is unknown. 274 * @return Other error codes as defined for each specific module 275 * message function. 354 276 * 355 277 * @see IS_NET_NETIF_MESSAGE() 356 278 * 357 279 */ 358 int netif_module_message_standalone(const char *name, ipc_callid_t callid,359 ipc_call_t * call, ipc_call_t *answer, int *answer_count)280 static int netif_module_message(ipc_callid_t callid, ipc_call_t *call, 281 ipc_call_t *answer, size_t *count) 360 282 { 361 283 size_t length; … … 365 287 int rc; 366 288 367 *answer_count = 0; 289 *count = 0; 290 368 291 switch (IPC_GET_IMETHOD(*call)) { 369 292 case IPC_M_PHONE_HUNGUP: … … 371 294 372 295 case NET_NETIF_PROBE: 373 return netif_probe_req_local(0, IPC_GET_DEVICE( call),374 NETIF_GET_IRQ( call), NETIF_GET_IO(call));375 296 return netif_probe_req_local(0, IPC_GET_DEVICE(*call), 297 NETIF_GET_IRQ(*call), NETIF_GET_IO(*call)); 298 376 299 case IPC_M_CONNECT_TO_ME: 377 300 fibril_rwlock_write_lock(&netif_globals.lock); 378 rc = register_message(name, IPC_GET_DEVICE(call), 379 IPC_GET_PHONE(call)); 301 302 rc = register_message(IPC_GET_DEVICE(*call), IPC_GET_PHONE(*call)); 303 380 304 fibril_rwlock_write_unlock(&netif_globals.lock); 381 305 return rc; 382 306 383 307 case NET_NETIF_SEND: 384 308 rc = packet_translate_remote(netif_globals.net_phone, &packet, 385 IPC_GET_PACKET( call));309 IPC_GET_PACKET(*call)); 386 310 if (rc != EOK) 387 311 return rc; 388 return netif_send_msg_local(0, IPC_GET_DEVICE(call), packet, 389 IPC_GET_SENDER(call)); 390 312 313 return netif_send_msg_local(0, IPC_GET_DEVICE(*call), packet, 314 IPC_GET_SENDER(*call)); 315 391 316 case NET_NETIF_START: 392 return netif_start_req_local(0, IPC_GET_DEVICE( call));393 317 return netif_start_req_local(0, IPC_GET_DEVICE(*call)); 318 394 319 case NET_NETIF_STATS: 395 320 fibril_rwlock_read_lock(&netif_globals.lock); 396 321 397 322 rc = async_data_read_receive(&callid, &length); 398 323 if (rc != EOK) { … … 400 325 return rc; 401 326 } 327 402 328 if (length < sizeof(device_stats_t)) { 403 329 fibril_rwlock_read_unlock(&netif_globals.lock); 404 330 return EOVERFLOW; 405 331 } 406 407 rc = netif_get_device_stats(IPC_GET_DEVICE( call), &stats);332 333 rc = netif_get_device_stats(IPC_GET_DEVICE(*call), &stats); 408 334 if (rc == EOK) { 409 335 rc = async_data_read_finalize(callid, &stats, 410 336 sizeof(device_stats_t)); 411 337 } 412 338 413 339 fibril_rwlock_read_unlock(&netif_globals.lock); 414 340 return rc; 415 341 416 342 case NET_NETIF_STOP: 417 return netif_stop_req_local(0, IPC_GET_DEVICE( call));418 343 return netif_stop_req_local(0, IPC_GET_DEVICE(*call)); 344 419 345 case NET_NETIF_GET_ADDR: 420 346 fibril_rwlock_read_lock(&netif_globals.lock); 421 rc = netif_get_addr_message(IPC_GET_DEVICE(call), &address); 347 348 rc = netif_get_addr_message(IPC_GET_DEVICE(*call), &address); 422 349 if (rc == EOK) 423 350 rc = measured_strings_reply(&address, 1); 351 424 352 fibril_rwlock_read_unlock(&netif_globals.lock); 425 353 return rc; 426 354 } 427 355 428 return netif_specific_message(callid, call, answer, answer_count); 356 return netif_specific_message(callid, call, answer, count); 357 } 358 359 /** Default fibril for new module connections. 360 * 361 * @param[in] iid Initial message identifier. 362 * @param[in] icall Initial message call structure. 363 * 364 */ 365 static void netif_client_connection(ipc_callid_t iid, ipc_call_t *icall) 366 { 367 /* 368 * Accept the connection by answering 369 * the initial IPC_M_CONNECT_ME_TO call. 370 */ 371 ipc_answer_0(iid, EOK); 372 373 while (true) { 374 ipc_call_t answer; 375 size_t count; 376 377 /* Clear the answer structure */ 378 refresh_answer(&answer, &count); 379 380 /* Fetch the next message */ 381 ipc_call_t call; 382 ipc_callid_t callid = async_get_call(&call); 383 384 /* Process the message */ 385 int res = netif_module_message(callid, &call, &answer, &count); 386 387 /* End if said to either by the message or the processing result */ 388 if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) || 389 (res == EHANGUP)) 390 return; 391 392 /* Answer the message */ 393 answer_call(callid, res, &answer, count); 394 } 429 395 } 430 396 … … 435 401 * messages in an infinite loop. 436 402 * 437 * @param[in] client_connection The client connection processing function. 438 * The module skeleton propagates its own one. 439 * @return EOK on success. 440 * @return Other error codes as defined for each specific module 441 * message function. 442 */ 443 int netif_module_start_standalone(async_client_conn_t client_connection) 444 { 445 int rc; 446 447 rc = netif_init_module(client_connection); 403 * @return EOK on success. 404 * @return Other error codes as defined for each specific module 405 * message function. 406 * 407 */ 408 int netif_module_start(void) 409 { 410 async_set_client_connection(netif_client_connection); 411 412 netif_globals.net_phone = connect_to_service(SERVICE_NETWORKING); 413 netif_device_map_initialize(&netif_globals.device_map); 414 415 int rc = pm_init(); 448 416 if (rc != EOK) 449 417 return rc; 418 419 fibril_rwlock_initialize(&netif_globals.lock); 420 421 rc = netif_initialize(); 422 if (rc != EOK) { 423 pm_destroy(); 424 return rc; 425 } 450 426 451 427 async_manager(); -
uspace/lib/net/nil/nil_remote.c
reaef141 r80cd7cd 33 33 /** @file 34 34 * Network interface layer interface implementation for remote modules. 35 * @see nil_ interface.h35 * @see nil_remote.h 36 36 */ 37 37 38 38 #include <nil_remote.h> 39 #include <nil_interface.h>40 39 #include <generic.h> 41 40 #include <net/device.h> 42 41 #include <net/packet.h> 43 42 #include <packet_client.h> 44 45 43 #include <ipc/nil.h> 46 44 47 45 /** Notify the network interface layer about the device state change. 48 46 * 49 * @param[in] nil_phone The network interface layer phone. 50 * @param[in] device_id The device identifier. 51 * @param[in] state The new device state. 52 * @return EOK on success. 53 * @return Other error codes as defined for each specific module 54 * device state function. 47 * @param[in] nil_phone Network interface layer phone. 48 * @param[in] device_id Device identifier. 49 * @param[in] state New device state. 50 * 51 * @return EOK on success. 52 * @return Other error codes as defined for each specific module 53 * device state function. 54 * 55 55 */ 56 int nil_device_state_msg _remote(int nil_phone, device_id_t device_id, int state)56 int nil_device_state_msg(int nil_phone, device_id_t device_id, int state) 57 57 { 58 58 return generic_device_state_msg_remote(nil_phone, NET_NIL_DEVICE_STATE, … … 65 65 * upper layers. 66 66 * 67 * @param[in] nil_phone The network interface layer phone. 68 * @param[in] device_id The source device identifier. 69 * @param[in] packet The received packet or the received packet queue. 70 * @param target The target service. Ignored parameter. 71 * @return EOK on success. 72 * @return Other error codes as defined for each specific module 73 * received function. 67 * @param[in] nil_phone Network interface layer phone. 68 * @param[in] device_id Source device identifier. 69 * @param[in] packet Received packet or the received packet queue. 70 * @param[in] target Target service. Ignored parameter. 71 * 72 * @return EOK on success. 73 * @return Other error codes as defined for each specific module 74 * received function. 75 * 74 76 */ 75 int nil_received_msg _remote(int nil_phone, device_id_t device_id,77 int nil_received_msg(int nil_phone, device_id_t device_id, 76 78 packet_t *packet, services_t target) 77 79 { -
uspace/lib/net/tl/socket_core.c
reaef141 r80cd7cd 161 161 static int 162 162 socket_port_add_core(socket_port_t *socket_port, socket_core_t *socket, 163 const char*key, size_t key_length)163 const uint8_t *key, size_t key_length) 164 164 { 165 165 socket_core_t **socket_ref; … … 216 216 goto fail; 217 217 218 rc = socket_port_add_core(socket_port, socket, SOCKET_MAP_KEY_LISTENING,219 0);218 rc = socket_port_add_core(socket_port, socket, 219 (const uint8_t *) SOCKET_MAP_KEY_LISTENING, 0); 220 220 if (rc != EOK) 221 221 goto fail; … … 602 602 */ 603 603 socket_core_t * 604 socket_port_find(socket_ports_t *global_sockets, int port, const char*key,604 socket_port_find(socket_ports_t *global_sockets, int port, const uint8_t *key, 605 605 size_t key_length) 606 606 { … … 680 680 int 681 681 socket_port_add(socket_ports_t *global_sockets, int port, 682 socket_core_t *socket, const char*key, size_t key_length)682 socket_core_t *socket, const uint8_t *key, size_t key_length) 683 683 { 684 684 socket_port_t *socket_port; -
uspace/lib/net/tl/tl_common.c
reaef141 r80cd7cd 42 42 #include <ip_remote.h> 43 43 #include <ip_interface.h> 44 #include <tl_ interface.h>44 #include <tl_remote.h> 45 45 46 46 #include <net/socket_codes.h> -
uspace/lib/net/tl/tl_remote.c
reaef141 r80cd7cd 31 31 */ 32 32 33 #include <tl_ interface.h>33 #include <tl_remote.h> 34 34 #include <generic.h> 35 35 #include <packet_client.h> … … 57 57 * 58 58 */ 59 int 60 tl_received_msg(int tl_phone, device_id_t device_id, packet_t *packet, 59 int tl_received_msg(int tl_phone, device_id_t device_id, packet_t *packet, 61 60 services_t target, services_t error) 62 61 {
Note:
See TracChangeset
for help on using the changeset viewer.