Changeset fdbc3ff in mainline for uspace/lib/net
- Timestamp:
- 2010-11-19T23:50:06Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 46d4d9f
- Parents:
- b4c9c61 (diff), a9c6b966 (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:
-
- 32 edited
-
adt/module_map.c (modified) (3 diffs)
-
generic/generic.c (modified) (3 diffs)
-
generic/net_checksum.c (modified) (6 diffs)
-
generic/net_remote.c (modified) (4 diffs)
-
generic/packet_client.c (modified) (10 diffs)
-
generic/packet_remote.c (modified) (4 diffs)
-
generic/protocol_map.c (modified) (5 diffs)
-
il/arp_remote.c (modified) (6 diffs)
-
il/ip_client.c (modified) (12 diffs)
-
il/ip_remote.c (modified) (3 diffs)
-
include/adt/module_map.h (modified) (2 diffs)
-
include/arp_interface.h (modified) (1 diff)
-
include/generic.h (modified) (2 diffs)
-
include/icmp_header.h (modified) (2 diffs)
-
include/il_local.h (modified) (2 diffs)
-
include/ip_header.h (modified) (2 diffs)
-
include/ip_interface.h (modified) (1 diff)
-
include/ip_remote.h (modified) (1 diff)
-
include/net_interface.h (modified) (1 diff)
-
include/netif_local.h (modified) (3 diffs)
-
include/netif_remote.h (modified) (2 diffs)
-
include/packet_client.h (modified) (3 diffs)
-
include/packet_remote.h (modified) (1 diff)
-
include/socket_core.h (modified) (3 diffs)
-
include/tl_common.h (modified) (1 diff)
-
include/tl_local.h (modified) (2 diffs)
-
netif/netif_local.c (modified) (3 diffs)
-
netif/netif_remote.c (modified) (2 diffs)
-
tl/icmp_client.c (modified) (3 diffs)
-
tl/icmp_remote.c (modified) (4 diffs)
-
tl/socket_core.c (modified) (15 diffs)
-
tl/tl_common.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/adt/module_map.c
rb4c9c61 rfdbc3ff 59 59 * running. 60 60 * @param[in] connect_module The module connecting function. 61 * @return sEOK on success.62 * @return sENOMEM if there is not enough memory left.61 * @return EOK on success. 62 * @return ENOMEM if there is not enough memory left. 63 63 */ 64 64 int 65 add_module(module_ ref *module, modules_refmodules, const char *name,65 add_module(module_t **module, modules_t *modules, const char *name, 66 66 const char *filename, services_t service, task_id_t task_id, 67 67 connect_module_t connect_module) 68 68 { 69 module_ reftmp_module;69 module_t *tmp_module; 70 70 int rc; 71 71 72 tmp_module = (module_ ref) malloc(sizeof(module_t));72 tmp_module = (module_t *) malloc(sizeof(module_t)); 73 73 if (!tmp_module) 74 74 return ENOMEM; … … 100 100 * @param[in] modules The module map. 101 101 * @param[in] name The module name. 102 * @return sThe running module found. It does not have to be102 * @return The running module found. It does not have to be 103 103 * connected. 104 * @return sNULL if there is no such module.104 * @return NULL if there is no such module. 105 105 */ 106 module_ ref get_running_module(modules_refmodules, char *name)106 module_t *get_running_module(modules_t *modules, char *name) 107 107 { 108 module_ refmodule;108 module_t *module; 109 109 110 110 module = modules_find(modules, name, 0); … … 126 126 * 127 127 * @param[in] fname The module full or relative path filename. 128 * @return sThe new module task identifier on success.129 * @return sZero if there is no such module.128 * @return The new module task identifier on success. 129 * @return Zero if there is no such module. 130 130 */ 131 131 task_id_t spawn(const char *fname) -
uspace/lib/net/generic/generic.c
rb4c9c61 rfdbc3ff 92 92 * @param[out] address The desired address. 93 93 * @param[out] data The address data container. 94 * @return sEOK on success.95 * @return sEBADMEM if the address parameter and/or the data94 * @return EOK on success. 95 * @return EBADMEM if the address parameter and/or the data 96 96 * parameter is NULL. 97 * @return sOther error codes as defined for the specific service97 * @return Other error codes as defined for the specific service 98 98 * message. 99 99 */ 100 100 int 101 101 generic_get_addr_req(int phone, int message, device_id_t device_id, 102 measured_string_ ref*address, char ** data)102 measured_string_t **address, char ** data) 103 103 { 104 104 aid_t message_id; … … 138 138 int 139 139 generic_packet_size_req_remote(int phone, int message, device_id_t device_id, 140 packet_dimension_ refpacket_dimension)140 packet_dimension_t *packet_dimension) 141 141 { 142 142 if (!packet_dimension) … … 223 223 * @param[out] translation The translated values. 224 224 * @param[out] data The translation data container. 225 * @return sEOK on success.226 * @return sEINVAL if the configuration parameter is NULL.227 * @return sEINVAL if the count parameter is zero.228 * @return sEBADMEM if the translation or the data parameters are225 * @return EOK on success. 226 * @return EINVAL if the configuration parameter is NULL. 227 * @return EINVAL if the count parameter is zero. 228 * @return EBADMEM if the translation or the data parameters are 229 229 * NULL. 230 * @return sOther error codes as defined for the specific service230 * @return Other error codes as defined for the specific service 231 231 * message. 232 232 */ 233 233 int 234 234 generic_translate_req(int phone, int message, device_id_t device_id, 235 services_t service, measured_string_ refconfiguration, size_t count,236 measured_string_ ref*translation, char **data)235 services_t service, measured_string_t *configuration, size_t count, 236 measured_string_t **translation, char **data) 237 237 { 238 238 aid_t message_id; -
uspace/lib/net/generic/net_checksum.c
rb4c9c61 rfdbc3ff 48 48 * 49 49 * @param[in] sum Computed checksum. 50 * @return sCompacted computed checksum to the 16 bits.50 * @return Compacted computed checksum to the 16 bits. 51 51 */ 52 52 uint16_t compact_checksum(uint32_t sum) … … 66 66 * @param[in] data Pointer to the beginning of data to process. 67 67 * @param[in] length Length of the data in bytes. 68 * @return sThe computed checksum of the length bytes of the data.68 * @return The computed checksum of the length bytes of the data. 69 69 */ 70 70 uint32_t compute_checksum(uint32_t seed, uint8_t *data, size_t length) … … 88 88 * @param[in] data Pointer to the beginning of data to process. 89 89 * @param[in] length Length of the data in bits. 90 * @return sThe computed CRC32 of the length bits of the data.90 * @return The computed CRC32 of the length bits of the data. 91 91 */ 92 92 uint32_t compute_crc32_be(uint32_t seed, uint8_t * data, size_t length) … … 142 142 * @param[in] data Pointer to the beginning of data to process. 143 143 * @param[in] length Length of the data in bits. 144 * @return sThe computed CRC32 of the length bits of the data.144 * @return The computed CRC32 of the length bits of the data. 145 145 */ 146 146 uint32_t compute_crc32_le(uint32_t seed, uint8_t * data, size_t length) … … 193 193 * 194 194 * @param[in] checksum The computed checksum. 195 * @return sThe internet protocol header checksum.196 * @return s0xFFFF if the computed checksum is zero.195 * @return The internet protocol header checksum. 196 * @return 0xFFFF if the computed checksum is zero. 197 197 */ 198 198 uint16_t flip_checksum(uint16_t checksum) … … 211 211 * @param[in] data The header data. 212 212 * @param[in] length The header length in bytes. 213 * @return sThe internet protocol header checksum.214 * @return s0xFFFF if the computed checksum is zero.213 * @return The internet protocol header checksum. 214 * @return 0xFFFF if the computed checksum is zero. 215 215 */ 216 216 uint16_t ip_checksum(uint8_t *data, size_t length) -
uspace/lib/net/generic/net_remote.c
rb4c9c61 rfdbc3ff 49 49 /** Connects to the networking module. 50 50 * 51 * @return sThe networking module phone on success.51 * @return The networking module phone on success. 52 52 */ 53 53 int net_connect_module(void) … … 63 63 * @see net_get_conf_req() 64 64 */ 65 void net_free_settings(measured_string_ refsettings, char *data)65 void net_free_settings(measured_string_t *settings, char *data) 66 66 { 67 67 if (settings) … … 83 83 * @param[in] count The configuration entries count. 84 84 * @param[in,out] data The configuration and settings data. 85 * @return sEOK on success.86 * @return sEINVAL if the configuration is NULL.87 * @return sEINVAL if the count is zero.88 * @return sOther error codes as defined for the85 * @return EOK on success. 86 * @return EINVAL if the configuration is NULL. 87 * @return EINVAL if the count is zero. 88 * @return Other error codes as defined for the 89 89 * generic_translate_req() function. 90 90 */ 91 91 int 92 net_get_conf_req(int net_phone, measured_string_ ref*configuration,92 net_get_conf_req(int net_phone, measured_string_t **configuration, 93 93 size_t count, char **data) 94 94 { … … 110 110 * @param[in] count The configuration entries count. 111 111 * @param[in,out] data The configuration and settings data. 112 * @return sEOK on success.113 * @return sEINVAL if the configuration is NULL.114 * @return sEINVAL if the count is zero.115 * @return sOther error codes as defined for the112 * @return EOK on success. 113 * @return EINVAL if the configuration is NULL. 114 * @return EINVAL if the count is zero. 115 * @return Other error codes as defined for the 116 116 * generic_translate_req() function. 117 117 */ 118 118 int 119 119 net_get_device_conf_req(int net_phone, device_id_t device_id, 120 measured_string_ ref*configuration, size_t count, char **data)120 measured_string_t **configuration, size_t count, char **data) 121 121 { 122 122 return generic_translate_req(net_phone, NET_NET_GET_DEVICE_CONF, -
uspace/lib/net/generic/packet_client.c
rb4c9c61 rfdbc3ff 53 53 * @param[in] data The data to be copied. 54 54 * @param[in] length The length of the copied data. 55 * @return sEOK on success.56 * @return sEINVAL if the packet is not valid.57 * @return sENOMEM if there is not enough memory left.55 * @return EOK on success. 56 * @return EINVAL if the packet is not valid. 57 * @return ENOMEM if there is not enough memory left. 58 58 */ 59 59 int packet_copy_data(packet_t packet, const void *data, size_t length) … … 78 78 * @param[in] length The space length to be allocated at the beginning of the 79 79 * packet content. 80 * @return sThe pointer to the allocated memory.81 * @return sNULL if there is not enough memory left.80 * @return The pointer to the allocated memory. 81 * @return NULL if there is not enough memory left. 82 82 */ 83 83 void *packet_prefix(packet_t packet, size_t length) … … 99 99 * @param[in] length The space length to be allocated at the end of the 100 100 * packet content. 101 * @return sThe pointer to the allocated memory.102 * @return sNULL if there is not enough memory left.101 * @return The pointer to the allocated memory. 102 * @return NULL if there is not enough memory left. 103 103 */ 104 104 void *packet_suffix(packet_t packet, size_t length) … … 120 120 * @param[in] suffix The suffix length to be removed from the end of the 121 121 * packet content. 122 * @return sEOK on success.123 * @return sEINVAL if the packet is not valid.124 * @return sENOMEM if there is not enough memory left.122 * @return EOK on success. 123 * @return EINVAL if the packet is not valid. 124 * @return ENOMEM if there is not enough memory left. 125 125 */ 126 126 int packet_trim(packet_t packet, size_t prefix, size_t suffix) … … 140 140 * 141 141 * @param[in] packet The packet. 142 * @return sThe packet identifier.143 * @return sZero if the packet is not valid.142 * @return The packet identifier. 143 * @return Zero if the packet is not valid. 144 144 */ 145 145 packet_id_t packet_get_id(const packet_t packet) … … 153 153 * @param[out] src The source address. May be NULL if not desired. 154 154 * @param[out] dest The destination address. May be NULL if not desired. 155 * @return sThe stored addresses length.156 * @return sZero if the addresses are not present.157 * @return sEINVAL if the packet is not valid.155 * @return The stored addresses length. 156 * @return Zero if the addresses are not present. 157 * @return EINVAL if the packet is not valid. 158 158 */ 159 159 int packet_get_addr(const packet_t packet, uint8_t **src, uint8_t **dest) … … 174 174 * 175 175 * @param[in] packet The packet. 176 * @return sThe packet content length in bytes.177 * @return sZero if the packet is not valid.176 * @return The packet content length in bytes. 177 * @return Zero if the packet is not valid. 178 178 */ 179 179 size_t packet_get_data_length(const packet_t packet) … … 188 188 * 189 189 * @param[in] packet The packet. 190 * @return sThe pointer to the beginning of the packet content.191 * @return sNULL if the packet is not valid.190 * @return The pointer to the beginning of the packet content. 191 * @return NULL if the packet is not valid. 192 192 */ 193 193 void *packet_get_data(const packet_t packet) … … 205 205 * @param[in] dest The new destination address. May be NULL. 206 206 * @param[in] addr_len The addresses length. 207 * @return sEOK on success.208 * @return sEINVAL if the packet is not valid.209 * @return sENOMEM if there is not enough memory left.207 * @return EOK on success. 208 * @return EINVAL if the packet is not valid. 209 * @return ENOMEM if there is not enough memory left. 210 210 */ 211 211 int … … 254 254 * @param[in] phone The packet server module phone. 255 255 * @param[in] packet The original packet. 256 * @return sThe packet copy.257 * @return sNULL on error.256 * @return The packet copy. 257 * @return NULL on error. 258 258 */ 259 259 packet_t packet_get_copy(int phone, packet_t packet) -
uspace/lib/net/generic/packet_remote.c
rb4c9c61 rfdbc3ff 64 64 */ 65 65 static int 66 packet_return(int phone, packet_ refpacket, packet_id_t packet_id, size_t size)66 packet_return(int phone, packet_t *packet, packet_id_t packet_id, size_t size) 67 67 { 68 68 ipc_call_t answer; … … 100 100 * @param[out] packet The packet reference. 101 101 * @param[in] packet_id The packet identifier. 102 * @return sEOK on success.103 * @return sEINVAL if the packet parameter is NULL.104 * @return sOther error codes as defined for the NET_PACKET_GET_SIZE102 * @return EOK on success. 103 * @return EINVAL if the packet parameter is NULL. 104 * @return Other error codes as defined for the NET_PACKET_GET_SIZE 105 105 * message. 106 * @return sOther error codes as defined for the packet_return()106 * @return Other error codes as defined for the packet_return() 107 107 * function. 108 108 */ 109 int packet_translate_remote(int phone, packet_ refpacket, packet_id_t packet_id)109 int packet_translate_remote(int phone, packet_t *packet, packet_id_t packet_id) 110 110 { 111 111 int rc; … … 145 145 * @param[in] max_content The maximal content length in bytes. 146 146 * @param[in] max_suffix The maximal suffix length in bytes. 147 * @return sThe packet reference.148 * @return sNULL on error.147 * @return The packet reference. 148 * @return NULL on error. 149 149 */ 150 150 packet_t packet_get_4_remote(int phone, size_t max_content, size_t addr_len, … … 177 177 * @param[in] phone The packet server module phone. 178 178 * @param[in] content The maximal content length in bytes. 179 * @return sThe packet reference.180 * @return sNULL on error.179 * @return The packet reference. 180 * @return NULL on error. 181 181 */ 182 182 packet_t packet_get_1_remote(int phone, size_t content) -
uspace/lib/net/generic/protocol_map.c
rb4c9c61 rfdbc3ff 42 42 * @param[in] nil Network interface layer service. 43 43 * @param[in] il Internetwork layer service. 44 * @return sNetwork interface layer type of the internetworking44 * @return Network interface layer type of the internetworking 45 45 * layer service. 46 * @return sZero if mapping is not found.46 * @return Zero if mapping is not found. 47 47 */ 48 48 eth_type_t protocol_map(services_t nil, services_t il) … … 68 68 * @param[in] nil Network interface layer service. 69 69 * @param[in] protocol Network interface layer type. 70 * @return sInternetwork layer service of the network interface70 * @return Internetwork layer service of the network interface 71 71 * layer type. 72 * @return sZero if mapping is not found.72 * @return Zero if mapping is not found. 73 73 */ 74 74 services_t protocol_unmap(services_t nil, int protocol) … … 94 94 * 95 95 * @param[in] lsap Link service access point identifier. 96 * @return sEthernet protocol identifier of the link service access96 * @return Ethernet protocol identifier of the link service access 97 97 * point identifier. 98 * @return sETH_LSAP_NULL if mapping is not found.98 * @return ETH_LSAP_NULL if mapping is not found. 99 99 */ 100 100 eth_type_t lsap_map(eth_lsap_t lsap) … … 114 114 * 115 115 * @param[in] ethertype Ethernet protocol identifier. 116 * @return sLink service access point identifier.117 * @return sZero if mapping is not found.116 * @return Link service access point identifier. 117 * @return Zero if mapping is not found. 118 118 */ 119 119 eth_lsap_t lsap_unmap(eth_type_t ethertype) … … 132 132 * 133 133 * @param[in] nil The network interface service. 134 * @return sThe hardware type of the network interface service.135 * @return sZero if mapping is not found.134 * @return The hardware type of the network interface service. 135 * @return Zero if mapping is not found. 136 136 */ 137 137 hw_type_t hardware_map(services_t nil) -
uspace/lib/net/il/arp_remote.c
rb4c9c61 rfdbc3ff 52 52 * 53 53 * @param service The ARP module service. Ignored parameter. 54 * @return sThe ARP module phone on success.54 * @return The ARP module phone on success. 55 55 */ 56 56 int arp_connect_module(services_t service) … … 65 65 * 66 66 * @param[in] arp_phone The ARP module phone used for (semi)remote calls. 67 * @return sEOK on success.67 * @return EOK on success. 68 68 */ 69 69 int arp_clean_cache_req(int arp_phone) … … 78 78 * @param[in] protocol The requesting protocol service. 79 79 * @param[in] address The protocol address to be cleared. 80 * @return sEOK on success.81 * @return sENOENT if the mapping is not found.80 * @return EOK on success. 81 * @return ENOENT if the mapping is not found. 82 82 */ 83 83 int 84 84 arp_clear_address_req(int arp_phone, device_id_t device_id, services_t protocol, 85 measured_string_ refaddress)85 measured_string_t *address) 86 86 { 87 87 aid_t message_id; … … 100 100 * @param[in] arp_phone The ARP module phone used for (semi)remote calls. 101 101 * @param[in] device_id The device identifier. 102 * @return sEOK on success.103 * @return sENOENT if the device is not found.102 * @return EOK on success. 103 * @return ENOENT if the device is not found. 104 104 */ 105 105 int arp_clear_device_req(int arp_phone, device_id_t device_id) … … 119 119 * @param[in] netif The underlying device network interface layer service. 120 120 * @param[in] address The local requesting protocol address of the device. 121 * @return sEOK on success.122 * @return sEEXIST if the device is already used.123 * @return sENOMEM if there is not enough memory left.124 * @return sENOENT if the network interface service is not known.125 * @return sEREFUSED if the network interface service is not121 * @return EOK on success. 122 * @return EEXIST if the device is already used. 123 * @return ENOMEM if there is not enough memory left. 124 * @return ENOENT if the network interface service is not known. 125 * @return EREFUSED if the network interface service is not 126 126 * responding. 127 * @return sOther error codes as defined for the127 * @return Other error codes as defined for the 128 128 * nil_packet_get_size() function. 129 * @return sOther error codes as defined for the nil_get_addr()129 * @return Other error codes as defined for the nil_get_addr() 130 130 * function. 131 * @return sOther error codes as defined for the131 * @return Other error codes as defined for the 132 132 * nil_get_broadcast_addr() function. 133 133 */ 134 134 int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol, 135 services_t netif, measured_string_ refaddress)135 services_t netif, measured_string_t *address) 136 136 { 137 137 aid_t message_id; … … 157 157 * @param[out] translation The translation of the local protocol address. 158 158 * @param[out] data The allocated raw translation data container. 159 * @return sEOK on success.160 * @return sEINVAL if the address parameter is NULL.161 * @return sEBADMEM if the translation or the data parameters are159 * @return EOK on success. 160 * @return EINVAL if the address parameter is NULL. 161 * @return EBADMEM if the translation or the data parameters are 162 162 * NULL. 163 * @return sENOENT if the mapping is not found.163 * @return ENOENT if the mapping is not found. 164 164 */ 165 165 int 166 166 arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol, 167 measured_string_ ref address, measured_string_ref*translation, char **data)167 measured_string_t *address, measured_string_t **translation, char **data) 168 168 { 169 169 return generic_translate_req(arp_phone, NET_ARP_TRANSLATE, device_id, -
uspace/lib/net/il/ip_client.c
rb4c9c61 rfdbc3ff 48 48 * 49 49 * @param[in] packet The packet. 50 * @return sThe IP header length in bytes.51 * @return sZero if there is no IP header.50 * @return The IP header length in bytes. 51 * @return Zero if there is no IP header. 52 52 */ 53 53 size_t ip_client_header_length(packet_t packet) 54 54 { 55 ip_header_ refheader;56 57 header = (ip_header_ ref) packet_get_data(packet);55 ip_header_t *header; 56 57 header = (ip_header_t *) packet_get_data(packet); 58 58 if (!header || (packet_get_data_length(packet) < sizeof(ip_header_t))) 59 59 return 0; … … 72 72 * @param[out] header The constructed IPv4 pseudo header. 73 73 * @param[out] headerlen The length of the IP pseudo header in bytes. 74 * @return sEOK on success.75 * @return sEBADMEM if the header and/or the headerlen parameter is74 * @return EOK on success. 75 * @return EBADMEM if the header and/or the headerlen parameter is 76 76 * NULL. 77 * @return sEINVAL if the source address and/or the destination77 * @return EINVAL if the source address and/or the destination 78 78 * address parameter is NULL. 79 * @return sEINVAL if the source address length is less than struct79 * @return EINVAL if the source address length is less than struct 80 80 * sockaddr length. 81 * @return sEINVAL if the source address length differs from the81 * @return EINVAL if the source address length differs from the 82 82 * destination address length. 83 * @return sEINVAL if the source address family differs from the83 * @return EINVAL if the source address family differs from the 84 84 * destination family. 85 * @return sEAFNOSUPPORT if the address family is not supported.86 * @return sENOMEM if there is not enough memory left.85 * @return EAFNOSUPPORT if the address family is not supported. 86 * @return ENOMEM if there is not enough memory left. 87 87 */ 88 88 int … … 91 91 size_t data_length, void **header, size_t *headerlen) 92 92 { 93 ipv4_pseudo_header_ refheader_in;93 ipv4_pseudo_header_t *header_in; 94 94 struct sockaddr_in *address_in; 95 95 … … 109 109 110 110 *headerlen = sizeof(*header_in); 111 header_in = (ipv4_pseudo_header_ ref) malloc(*headerlen);111 header_in = (ipv4_pseudo_header_t *) malloc(*headerlen); 112 112 if (!header_in) 113 113 return ENOMEM; … … 148 148 * disabled. 149 149 * @param[in] ipopt_length The prefixed IP options length in bytes. 150 * @return sEOK on success.151 * @return sENOMEM if there is not enough memory left in the packet.150 * @return EOK on success. 151 * @return ENOMEM if there is not enough memory left in the packet. 152 152 */ 153 153 int … … 155 155 ip_tos_t tos, int dont_fragment, size_t ipopt_length) 156 156 { 157 ip_header_ refheader;157 ip_header_t *header; 158 158 uint8_t *data; 159 159 size_t padding; … … 177 177 178 178 // set the header 179 header = (ip_header_ ref) data;179 header = (ip_header_t *) data; 180 180 header->header_length = IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) + 181 181 ipopt_length); … … 203 203 * @param[out] ipopt_length The IP options length in bytes. May be NULL if not 204 204 * desired. 205 * @return sThe prefixed IP header length in bytes on success.206 * @return sENOMEM if the packet is too short to contain the IP205 * @return The prefixed IP header length in bytes on success. 206 * @return ENOMEM if the packet is too short to contain the IP 207 207 * header. 208 208 */ … … 211 211 ip_ttl_t *ttl, ip_tos_t *tos, int *dont_fragment, size_t *ipopt_length) 212 212 { 213 ip_header_ refheader;214 215 header = (ip_header_ ref) packet_get_data(packet);213 ip_header_t *header; 214 215 header = (ip_header_t *) packet_get_data(packet); 216 216 if (!header || (packet_get_data_length(packet) < sizeof(ip_header_t))) 217 217 return ENOMEM; … … 238 238 * @param[in] headerlen The length of the IP pseudo header in bytes. 239 239 * @param[in] data_length The data length to be set. 240 * @return sEOK on success.241 * @return sEBADMEM if the header parameter is NULL.242 * @return sEINVAL if the headerlen parameter is not IPv4 pseudo240 * @return EOK on success. 241 * @return EBADMEM if the header parameter is NULL. 242 * @return EINVAL if the headerlen parameter is not IPv4 pseudo 243 243 * header length. 244 244 */ … … 247 247 size_t data_length) 248 248 { 249 ipv4_pseudo_header_ refheader_in;249 ipv4_pseudo_header_t *header_in; 250 250 251 251 if (!header) … … 253 253 254 254 if (headerlen == sizeof(ipv4_pseudo_header_t)) { 255 header_in = (ipv4_pseudo_header_ ref) header;255 header_in = (ipv4_pseudo_header_t *) header; 256 256 header_in->data_length = htons(data_length); 257 257 return EOK; -
uspace/lib/net/il/ip_remote.c
rb4c9c61 rfdbc3ff 78 78 * @param[in] me The requesting module service. 79 79 * @param[in] receiver The message receiver. Used for remote connection. 80 * @return sThe phone of the needed service.81 * @return sEOK on success.82 * @return sOther error codes as defined for the bind_service()80 * @return The phone of the needed service. 81 * @return EOK on success. 82 * @return Other error codes as defined for the bind_service() 83 83 * function. 84 84 */ … … 93 93 * 94 94 * @param service The IP module service. Ignored parameter. 95 * @return sThe IP module phone on success.95 * @return The IP module phone on success. 96 96 */ 97 97 int ip_connect_module(services_t service) … … 186 186 */ 187 187 int ip_packet_size_req_remote(int ip_phone, device_id_t device_id, 188 packet_dimension_ refpacket_dimension)188 packet_dimension_t *packet_dimension) 189 189 { 190 190 return generic_packet_size_req_remote(ip_phone, NET_IL_PACKET_SPACE, -
uspace/lib/net/include/adt/module_map.h
rb4c9c61 rfdbc3ff 48 48 typedef struct module_struct module_t; 49 49 50 /** Type definition of the module structure pointer.51 * @see module_struct52 */53 typedef module_t *module_ref;54 55 50 /** Module map. 56 51 * Sorted by module names. … … 77 72 }; 78 73 79 extern int add_module(module_ ref *, modules_ref, const char *, const char *,74 extern int add_module(module_t **, modules_t *, const char *, const char *, 80 75 services_t, task_id_t, connect_module_t *); 81 extern module_ ref get_running_module(modules_ref, char *);76 extern module_t *get_running_module(modules_t *, char *); 82 77 extern task_id_t spawn(const char *); 83 78 -
uspace/lib/net/include/arp_interface.h
rb4c9c61 rfdbc3ff 48 48 49 49 extern int arp_device_req(int, device_id_t, services_t, services_t, 50 measured_string_ ref);51 extern int arp_translate_req(int, device_id_t, services_t, measured_string_ ref,52 measured_string_ ref*, char **);50 measured_string_t *); 51 extern int arp_translate_req(int, device_id_t, services_t, measured_string_t *, 52 measured_string_t **, char **); 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, 55 measured_string_ ref);55 measured_string_t *); 56 56 extern int arp_clean_cache_req(int); 57 57 extern int arp_connect_module(services_t); -
uspace/lib/net/include/generic.h
rb4c9c61 rfdbc3ff 49 49 services_t); 50 50 extern int generic_device_req_remote(int, int, device_id_t, int, services_t); 51 extern int generic_get_addr_req(int, int, device_id_t, measured_string_ ref*,51 extern int generic_get_addr_req(int, int, device_id_t, measured_string_t **, 52 52 char **); 53 53 extern int generic_packet_size_req_remote(int, int, device_id_t, 54 packet_dimension_ ref);54 packet_dimension_t *); 55 55 extern int generic_received_msg_remote(int, int, device_id_t, packet_id_t, 56 56 services_t, services_t); … … 58 58 services_t, services_t); 59 59 extern int generic_translate_req(int, int, device_id_t, services_t, 60 measured_string_ ref, size_t, measured_string_ref*, char **);60 measured_string_t *, size_t, measured_string_t **, char **); 61 61 62 62 #endif -
uspace/lib/net/include/icmp_header.h
rb4c9c61 rfdbc3ff 52 52 typedef struct icmp_echo icmp_echo_t; 53 53 54 /** Type definition of the echo specific data pointer.55 * @see icmp_echo56 */57 typedef icmp_echo_t *icmp_echo_ref;58 59 54 /** Echo specific data. */ 60 55 struct icmp_echo { … … 69 64 */ 70 65 typedef struct icmp_header icmp_header_t; 71 72 /** Type definition of the internet control message header pointer.73 * @see icmp_header74 */75 typedef icmp_header_t *icmp_header_ref;76 66 77 67 /** Internet control message header. */ -
uspace/lib/net/include/il_local.h
rb4c9c61 rfdbc3ff 44 44 * @param[out] answer_count The last parameter for the actual answer in 45 45 * the answer parameter. 46 * @return sEOK on success.47 * @return sOther error codes as defined for the arp_message()46 * @return EOK on success. 47 * @return Other error codes as defined for the arp_message() 48 48 * function. 49 49 */ … … 59 59 * @param[in] client_connection The client connection processing function. The 60 60 * module skeleton propagates its own one. 61 * @return sEOK on successful module termination.62 * @return sOther error codes as defined for the arp_initialize()61 * @return EOK on successful module termination. 62 * @return Other error codes as defined for the arp_initialize() 63 63 * function. 64 * @return sOther error codes as defined for the REGISTER_ME() macro64 * @return Other error codes as defined for the REGISTER_ME() macro 65 65 * function. 66 66 */ -
uspace/lib/net/include/ip_header.h
rb4c9c61 rfdbc3ff 127 127 typedef struct ip_header ip_header_t; 128 128 129 /** Type definition of the internet header pointer.130 * @see ip_header131 */132 typedef ip_header_t *ip_header_ref;133 134 129 /** Type definition of the internet option header. 135 130 * @see ip_header … … 137 132 typedef struct ip_option ip_option_t; 138 133 139 /** Type definition of the internet option header pointer.140 * @see ip_header141 */142 typedef ip_option_t *ip_option_ref;143 144 134 /** Type definition of the internet version 4 pseudo header. 145 135 * @see ipv4_pseudo_header 146 136 */ 147 137 typedef struct ipv4_pseudo_header ipv4_pseudo_header_t; 148 149 /** Type definition of the internet version 4 pseudo header pointer.150 * @see ipv4_pseudo_header151 */152 typedef ipv4_pseudo_header_t *ipv4_pseudo_header_ref;153 138 154 139 /** Internet header. -
uspace/lib/net/include/ip_interface.h
rb4c9c61 rfdbc3ff 68 68 * @param[in] error The packet error reporting service. Prefixes the 69 69 * received packet. 70 * @return sEOK on success.70 * @return EOK on success. 71 71 */ 72 72 typedef int (*tl_received_msg_t)(device_id_t device_id, packet_t packet, -
uspace/lib/net/include/ip_remote.h
rb4c9c61 rfdbc3ff 44 44 45 45 extern int ip_set_gateway_req_remote(int, device_id_t, in_addr_t); 46 extern int ip_packet_size_req_remote(int, device_id_t, packet_dimension_ ref);46 extern int ip_packet_size_req_remote(int, device_id_t, packet_dimension_t *); 47 47 extern int ip_received_error_msg_remote(int, device_id_t, packet_t, services_t, 48 48 services_t); -
uspace/lib/net/include/net_interface.h
rb4c9c61 rfdbc3ff 44 44 /*@{*/ 45 45 46 extern int net_get_device_conf_req(int, device_id_t, measured_string_ ref*,46 extern int net_get_device_conf_req(int, device_id_t, measured_string_t **, 47 47 size_t, char **); 48 extern int net_get_conf_req(int, measured_string_ ref*, size_t, char **);49 extern void net_free_settings(measured_string_ ref, 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 *); 50 50 extern int net_connect_module(void); 51 51 -
uspace/lib/net/include/netif_local.h
rb4c9c61 rfdbc3ff 158 158 */ 159 159 extern int netif_get_addr_message(device_id_t device_id, 160 measured_string_ refaddress);160 measured_string_t *address); 161 161 162 162 /** Process the netif driver specific message. … … 193 193 */ 194 194 extern int netif_get_device_stats(device_id_t device_id, 195 device_stats_ refstats);196 197 extern int netif_get_addr_req_local(int, device_id_t, measured_string_ ref*,195 device_stats_t *stats); 196 197 extern int netif_get_addr_req_local(int, device_id_t, measured_string_t **, 198 198 char **); 199 199 extern int netif_probe_req_local(int, device_id_t, int, int); … … 201 201 extern int netif_start_req_local(int, device_id_t); 202 202 extern int netif_stop_req_local(int, device_id_t); 203 extern int netif_stats_req_local(int, device_id_t, device_stats_ ref);203 extern int netif_stats_req_local(int, device_id_t, device_stats_t *); 204 204 extern int netif_bind_service_local(services_t, device_id_t, services_t, 205 205 async_client_conn_t); 206 206 207 207 extern int find_device(device_id_t, netif_device_t **); 208 extern void null_device_stats(device_stats_ ref);208 extern void null_device_stats(device_stats_t *); 209 209 extern void netif_pq_release(packet_id_t); 210 210 extern packet_t netif_packet_get_1(size_t); -
uspace/lib/net/include/netif_remote.h
rb4c9c61 rfdbc3ff 41 41 #include <net/packet.h> 42 42 43 extern int netif_get_addr_req_remote(int, device_id_t, measured_string_ ref*,43 extern int netif_get_addr_req_remote(int, device_id_t, measured_string_t **, 44 44 char **); 45 45 extern int netif_probe_req_remote(int, device_id_t, int, int); … … 47 47 extern int netif_start_req_remote(int, device_id_t); 48 48 extern int netif_stop_req_remote(int, device_id_t); 49 extern int netif_stats_req_remote(int, device_id_t, device_stats_ ref);49 extern int netif_stats_req_remote(int, device_id_t, device_stats_t *); 50 50 extern int netif_bind_service_remote(services_t, device_id_t, services_t, 51 51 async_client_conn_t); -
uspace/lib/net/include/packet_client.h
rb4c9c61 rfdbc3ff 61 61 * @param[in] type The type to be allocated at the beginning of the packet 62 62 * content. 63 * @return sThe typed pointer to the allocated memory.64 * @return sNULL if the packet is not valid.65 * @return sNULL if there is not enough memory left.63 * @return The typed pointer to the allocated memory. 64 * @return NULL if the packet is not valid. 65 * @return NULL if there is not enough memory left. 66 66 */ 67 67 #define PACKET_PREFIX(packet, type) \ … … 76 76 * @param[in] type The type to be allocated at the end of the packet 77 77 * content. 78 * @return sThe typed pointer to the allocated memory.79 * @return sNULL if the packet is not valid.80 * @return sNULL if there is not enough memory left.78 * @return The typed pointer to the allocated memory. 79 * @return NULL if the packet is not valid. 80 * @return NULL if there is not enough memory left. 81 81 */ 82 82 #define PACKET_SUFFIX(packet, type) \ … … 92 92 * @param[in] suffix The type of the suffix to be removed from the end of 93 93 * the packet content. 94 * @return sEOK on success.95 * @return sEINVAL if the packet is not valid.96 * @return sENOMEM if there is not enough memory left.94 * @return EOK on success. 95 * @return EINVAL if the packet is not valid. 96 * @return ENOMEM if there is not enough memory left. 97 97 */ 98 98 #define PACKET_TRIM(packet, prefix, suffix) \ -
uspace/lib/net/include/packet_remote.h
rb4c9c61 rfdbc3ff 37 37 #include <sys/types.h> 38 38 39 extern int packet_translate_remote(int, packet_ ref, packet_id_t);39 extern int packet_translate_remote(int, packet_t *, packet_id_t); 40 40 extern packet_t packet_get_4_remote(int, size_t, size_t, size_t, size_t); 41 41 extern packet_t packet_get_1_remote(int, size_t); -
uspace/lib/net/include/socket_core.h
rb4c9c61 rfdbc3ff 66 66 typedef struct socket_core socket_core_t; 67 67 68 /** Type definition of the socket core pointer.69 * @see socket_core70 */71 typedef socket_core_t *socket_core_ref;72 73 68 /** Type definition of the socket port. 74 69 * @see socket_port 75 70 */ 76 71 typedef struct socket_port socket_port_t; 77 78 /** Type definition of the socket port pointer.79 * @see socket_port80 */81 typedef socket_port_t *socket_port_ref;82 72 83 73 /** Socket core. */ … … 111 101 * the other use the remote addresses. 112 102 */ 113 GENERIC_CHAR_MAP_DECLARE(socket_port_map, socket_core_ ref);103 GENERIC_CHAR_MAP_DECLARE(socket_port_map, socket_core_t *); 114 104 115 105 /** Ports map. … … 118 108 INT_MAP_DECLARE(socket_ports, socket_port_t); 119 109 120 extern void socket_cores_release(int, socket_cores_ ref, socket_ports_ref,121 void (*)(socket_core_ ref));122 extern int socket_bind(socket_cores_ ref, socket_ports_ref, int, void *, size_t,110 extern void socket_cores_release(int, socket_cores_t *, socket_ports_t *, 111 void (*)(socket_core_t *)); 112 extern int socket_bind(socket_cores_t *, socket_ports_t *, int, void *, size_t, 123 113 int, int, int); 124 extern int socket_bind_free_port(socket_ports_ ref, socket_core_ref, int, int,114 extern int socket_bind_free_port(socket_ports_t *, socket_core_t *, int, int, 125 115 int); 126 extern int socket_create(socket_cores_ ref, int, void *, int *);127 extern int socket_destroy(int, int, socket_cores_ ref, socket_ports_ref,128 void (*)(socket_core_ ref));116 extern int socket_create(socket_cores_t *, int, void *, int *); 117 extern int socket_destroy(int, int, socket_cores_t *, socket_ports_t *, 118 void (*)(socket_core_t *)); 129 119 extern int socket_reply_packets(packet_t, size_t *); 130 extern socket_core_ ref socket_port_find(socket_ports_ref, int, const char *,120 extern socket_core_t *socket_port_find(socket_ports_t *, int, const char *, 131 121 size_t); 132 extern void socket_port_release(socket_ports_ ref, socket_core_ref);133 extern int socket_port_add(socket_ports_ ref, int, socket_core_ref,122 extern void socket_port_release(socket_ports_t *, socket_core_t *); 123 extern int socket_port_add(socket_ports_t *, int, socket_core_t *, 134 124 const char *, size_t); 135 125 -
uspace/lib/net/include/tl_common.h
rb4c9c61 rfdbc3ff 51 51 DEVICE_MAP_DECLARE(packet_dimensions, packet_dimension_t); 52 52 53 extern int tl_get_ip_packet_dimension(int, packet_dimensions_ ref,54 device_id_t, packet_dimension_ ref*);53 extern int tl_get_ip_packet_dimension(int, packet_dimensions_t *, 54 device_id_t, packet_dimension_t **); 55 55 extern int tl_get_address_port(const struct sockaddr *, int, uint16_t *); 56 extern int tl_update_ip_packet_dimension(packet_dimensions_ ref, device_id_t,56 extern int tl_update_ip_packet_dimension(packet_dimensions_t *, device_id_t, 57 57 size_t); 58 58 extern int tl_set_address_port(struct sockaddr *, int, uint16_t); 59 59 extern int tl_prepare_icmp_packet(int, int, packet_t, services_t); 60 extern int tl_socket_read_packet_data(int, packet_ ref, size_t,61 const packet_dimension_ ref, const struct sockaddr *, socklen_t);60 extern int tl_socket_read_packet_data(int, packet_t *, size_t, 61 const packet_dimension_t *, const struct sockaddr *, socklen_t); 62 62 63 63 #endif -
uspace/lib/net/include/tl_local.h
rb4c9c61 rfdbc3ff 45 45 * @param[in] client_connection The client connection processing function. The 46 46 * module skeleton propagates its own one. 47 * @return sEOK on successful module termination.48 * @return sOther error codes as defined for the module initialize47 * @return EOK on successful module termination. 48 * @return Other error codes as defined for the module initialize 49 49 * function. 50 * @return sOther error codes as defined for the REGISTER_ME() macro50 * @return Other error codes as defined for the REGISTER_ME() macro 51 51 * function. 52 52 */ … … 62 62 * @param[out] answer_count The last parameter for the actual answer in the 63 63 * answer parameter. 64 * @return sEOK on success.65 * @return sOther error codes as defined for the module's message64 * @return EOK on success. 65 * @return Other error codes as defined for the module's message 66 66 * standalone function. 67 67 */ -
uspace/lib/net/netif/netif_local.c
rb4c9c61 rfdbc3ff 181 181 */ 182 182 int netif_stats_req_local(int netif_phone, device_id_t device_id, 183 device_stats_ refstats)183 device_stats_t *stats) 184 184 { 185 185 fibril_rwlock_read_lock(&netif_globals.lock); … … 203 203 */ 204 204 int netif_get_addr_req_local(int netif_phone, device_id_t device_id, 205 measured_string_ ref*address, char **data)205 measured_string_t **address, char **data) 206 206 { 207 207 int rc; … … 253 253 * @param[in] stats The usage statistics. 254 254 */ 255 void null_device_stats(device_stats_ refstats)255 void null_device_stats(device_stats_t *stats) 256 256 { 257 257 bzero(stats, sizeof(device_stats_t)); -
uspace/lib/net/netif/netif_remote.c
rb4c9c61 rfdbc3ff 60 60 */ 61 61 int netif_get_addr_req_remote(int netif_phone, device_id_t device_id, 62 measured_string_ ref*address, char **data)62 measured_string_t **address, char **data) 63 63 { 64 64 return generic_get_addr_req(netif_phone, NET_NETIF_GET_ADDR, device_id, … … 138 138 */ 139 139 int netif_stats_req_remote(int netif_phone, device_id_t device_id, 140 device_stats_ refstats)140 device_stats_t *stats) 141 141 { 142 142 if (!stats) -
uspace/lib/net/tl/icmp_client.c
rb4c9c61 rfdbc3ff 57 57 * @param[out] pointer The ICMP header pointer. 58 58 * @param[out] mtu The ICMP header MTU. 59 * @return sThe ICMP header length.60 * @return sZero if the packet contains no data.59 * @return The ICMP header length. 60 * @return Zero if the packet contains no data. 61 61 */ 62 62 int … … 64 64 icmp_code_t *code, icmp_param_t *pointer, icmp_param_t *mtu) 65 65 { 66 icmp_header_ refheader;66 icmp_header_t *header; 67 67 68 header = (icmp_header_ ref) packet_get_data(packet);68 header = (icmp_header_t *) packet_get_data(packet); 69 69 if (!header || 70 70 (packet_get_data_length(packet) < sizeof(icmp_header_t))) { … … 92 92 * 93 93 * @param[in] packet The packet. 94 * @return sThe ICMP header length in bytes.94 * @return The ICMP header length in bytes. 95 95 */ 96 96 size_t icmp_client_header_length(packet_t packet) -
uspace/lib/net/tl/icmp_remote.c
rb4c9c61 rfdbc3ff 57 57 * @param[in] mtu The error MTU value. 58 58 * @param[in] packet The original packet. 59 * @return sEOK on success.60 * @return sEPERM if the ICMP error notifications are disabled.61 * @return sENOMEM if there is not enough memory left.59 * @return EOK on success. 60 * @return EPERM if the ICMP error notifications are disabled. 61 * @return ENOMEM if there is not enough memory left. 62 62 */ 63 63 int … … 78 78 * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. 79 79 * @param[in] packet The original packet. 80 * @return sEOK on success.81 * @return sEPERM if the ICMP error notifications are disabled.82 * @return sENOMEM if there is not enough memory left.80 * @return EOK on success. 81 * @return EPERM if the ICMP error notifications are disabled. 82 * @return ENOMEM if there is not enough memory left. 83 83 */ 84 84 int icmp_source_quench_msg(int icmp_phone, packet_t packet) … … 98 98 * @param[in] code The error specific code. 99 99 * @param[in] packet The original packet. 100 * @return sEOK on success.101 * @return sEPERM if the ICMP error notifications are disabled.102 * @return sENOMEM if there is not enough memory left.100 * @return EOK on success. 101 * @return EPERM if the ICMP error notifications are disabled. 102 * @return ENOMEM if there is not enough memory left. 103 103 */ 104 104 int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t packet) … … 119 119 * @param[in] pointer The problematic parameter offset. 120 120 * @param[in] packet The original packet. 121 * @return sEOK on success.122 * @return sEPERM if the ICMP error notifications are disabled.123 * @return sENOMEM if there is not enough memory left.121 * @return EOK on success. 122 * @return EPERM if the ICMP error notifications are disabled. 123 * @return ENOMEM if there is not enough memory left. 124 124 */ 125 125 int icmp_parameter_problem_msg(int icmp_phone, icmp_code_t code, -
uspace/lib/net/tl/socket_core.c
rb4c9c61 rfdbc3ff 68 68 INT_MAP_IMPLEMENT(socket_cores, socket_core_t); 69 69 70 GENERIC_CHAR_MAP_IMPLEMENT(socket_port_map, socket_core_ ref);70 GENERIC_CHAR_MAP_IMPLEMENT(socket_port_map, socket_core_t *); 71 71 72 72 INT_MAP_IMPLEMENT(socket_ports, socket_port_t); … … 85 85 */ 86 86 static void 87 socket_destroy_core(int packet_phone, socket_core_ refsocket,88 socket_cores_ ref local_sockets, socket_ports_refglobal_sockets,89 void (* socket_release)(socket_core_ refsocket))87 socket_destroy_core(int packet_phone, socket_core_t *socket, 88 socket_cores_t *local_sockets, socket_ports_t *global_sockets, 89 void (* socket_release)(socket_core_t *socket)) 90 90 { 91 91 int packet_id; … … 121 121 */ 122 122 void 123 socket_cores_release(int packet_phone, socket_cores_ reflocal_sockets,124 socket_ports_ refglobal_sockets,125 void (* socket_release)(socket_core_ refsocket))123 socket_cores_release(int packet_phone, socket_cores_t *local_sockets, 124 socket_ports_t *global_sockets, 125 void (* socket_release)(socket_core_t *socket)) 126 126 { 127 127 int index; … … 156 156 * @param[in] key The socket key identifier. 157 157 * @param[in] key_length The socket key length. 158 * @return sEOK on success.159 * @return sENOMEM if there is not enough memory left.158 * @return EOK on success. 159 * @return ENOMEM if there is not enough memory left. 160 160 */ 161 161 static int 162 socket_port_add_core(socket_port_ ref socket_port, socket_core_refsocket,162 socket_port_add_core(socket_port_t *socket_port, socket_core_t *socket, 163 163 const char *key, size_t key_length) 164 164 { 165 socket_core_ ref*socket_ref;165 socket_core_t **socket_ref; 166 166 int rc; 167 167 … … 194 194 * @param[in] socket The socket to be added. 195 195 * @param[in] port The port number to be bound to. 196 * @return sEOK on success.197 * @return sENOMEM if there is not enough memory left.198 * @return sOther error codes as defined for the196 * @return EOK on success. 197 * @return ENOMEM if there is not enough memory left. 198 * @return Other error codes as defined for the 199 199 * socket_ports_add() function. 200 200 */ 201 201 static int 202 socket_bind_insert(socket_ports_ ref global_sockets, socket_core_refsocket,202 socket_bind_insert(socket_ports_t *global_sockets, socket_core_t *socket, 203 203 int port) 204 204 { 205 socket_port_ refsocket_port;205 socket_port_t *socket_port; 206 206 int rc; 207 207 … … 248 248 * @param[in] free_ports_end The maximum free port. 249 249 * @param[in] last_used_port The last used free port. 250 * @return sEOK on success.251 * @return sENOTSOCK if the socket was not found.252 * @return sEAFNOSUPPORT if the address family is not supported.253 * @return sEADDRINUSE if the port is already in use.254 * @return sOther error codes as defined for the250 * @return EOK on success. 251 * @return ENOTSOCK if the socket was not found. 252 * @return EAFNOSUPPORT if the address family is not supported. 253 * @return EADDRINUSE if the port is already in use. 254 * @return Other error codes as defined for the 255 255 * socket_bind_free_port() function. 256 * @return sOther error codes as defined for the256 * @return Other error codes as defined for the 257 257 * socket_bind_insert() function. 258 258 */ 259 259 int 260 socket_bind(socket_cores_ ref local_sockets, socket_ports_refglobal_sockets,260 socket_bind(socket_cores_t *local_sockets, socket_ports_t *global_sockets, 261 261 int socket_id, void *addr, size_t addrlen, int free_ports_start, 262 262 int free_ports_end, int last_used_port) 263 263 { 264 socket_core_ refsocket;265 socket_port_ refsocket_port;264 socket_core_t *socket; 265 socket_port_t *socket_port; 266 266 struct sockaddr *address; 267 267 struct sockaddr_in *address_in; … … 322 322 * @param[in] free_ports_end The maximum free port. 323 323 * @param[in] last_used_port The last used free port. 324 * @return sEOK on success.325 * @return sENOTCONN if no free port was found.326 * @return sOther error codes as defined for the324 * @return EOK on success. 325 * @return ENOTCONN if no free port was found. 326 * @return Other error codes as defined for the 327 327 * socket_bind_insert() function. 328 328 */ 329 329 int 330 socket_bind_free_port(socket_ports_ ref global_sockets, socket_core_refsocket,330 socket_bind_free_port(socket_ports_t *global_sockets, socket_core_t *socket, 331 331 int free_ports_start, int free_ports_end, int last_used_port) 332 332 { … … 367 367 * requested. A negative identifier is requested if set to 368 368 * false. 369 * @return sThe new socket identifier.370 * @return sELIMIT if there is no socket identifier available.371 */ 372 static int socket_generate_new_id(socket_cores_ reflocal_sockets, int positive)369 * @return The new socket identifier. 370 * @return ELIMIT if there is no socket identifier available. 371 */ 372 static int socket_generate_new_id(socket_cores_t *local_sockets, int positive) 373 373 { 374 374 int socket_id; … … 410 410 * chosen if set to zero or negative. A negative identifier 411 411 * is chosen if set to negative. 412 * @return sEOK on success.413 * @return sEINVAL if the socket_id parameter is NULL.414 * @return sENOMEM if there is not enough memory left.412 * @return EOK on success. 413 * @return EINVAL if the socket_id parameter is NULL. 414 * @return ENOMEM if there is not enough memory left. 415 415 */ 416 416 int 417 socket_create(socket_cores_ reflocal_sockets, int app_phone,417 socket_create(socket_cores_t *local_sockets, int app_phone, 418 418 void *specific_data, int *socket_id) 419 419 { 420 socket_core_ refsocket;420 socket_core_t *socket; 421 421 int positive; 422 422 int rc; … … 437 437 } 438 438 439 socket = (socket_core_ ref) malloc(sizeof(*socket));439 socket = (socket_core_t *) malloc(sizeof(*socket)); 440 440 if (!socket) 441 441 return ENOMEM; … … 482 482 * @param[in,out] global_sockets The global sockets to be updated. 483 483 * @param[in] socket_release The client release callback function. 484 * @return sEOK on success.485 * @return sENOTSOCK if the socket is not found.484 * @return EOK on success. 485 * @return ENOTSOCK if the socket is not found. 486 486 */ 487 487 int 488 socket_destroy(int packet_phone, int socket_id, socket_cores_ reflocal_sockets,489 socket_ports_ refglobal_sockets,490 void (*socket_release)(socket_core_ refsocket))491 { 492 socket_core_ refsocket;488 socket_destroy(int packet_phone, int socket_id, socket_cores_t *local_sockets, 489 socket_ports_t *global_sockets, 490 void (*socket_release)(socket_core_t *socket)) 491 { 492 socket_core_t *socket; 493 493 int accepted_id; 494 494 … … 516 516 * @param[in] packet The packet to be transfered. 517 517 * @param[out] length The total data length. 518 * @return sEOK on success.519 * @return sEBADMEM if the length parameter is NULL.520 * @return sENOMEM if there is not enough memory left.521 * @return sOther error codes as defined for the data_reply()518 * @return EOK on success. 519 * @return EBADMEM if the length parameter is NULL. 520 * @return ENOMEM if there is not enough memory left. 521 * @return Other error codes as defined for the data_reply() 522 522 * function. 523 523 */ … … 598 598 * @param[in] key The socket key identifier. 599 599 * @param[in] key_length The socket key length. 600 * @return sThe found socket.601 * @return sNULL if no socket was found.602 */ 603 socket_core_ ref604 socket_port_find(socket_ports_ refglobal_sockets, int port, const char *key,600 * @return The found socket. 601 * @return NULL if no socket was found. 602 */ 603 socket_core_t * 604 socket_port_find(socket_ports_t *global_sockets, int port, const char *key, 605 605 size_t key_length) 606 606 { 607 socket_port_ refsocket_port;608 socket_core_ ref*socket_ref;607 socket_port_t *socket_port; 608 socket_core_t **socket_ref; 609 609 610 610 socket_port = socket_ports_find(global_sockets, port); … … 628 628 */ 629 629 void 630 socket_port_release(socket_ports_ ref global_sockets, socket_core_refsocket)631 { 632 socket_port_ refsocket_port;633 socket_core_ ref*socket_ref;630 socket_port_release(socket_ports_t *global_sockets, socket_core_t *socket) 631 { 632 socket_port_t *socket_port; 633 socket_core_t **socket_ref; 634 634 635 635 if (!socket->port) … … 673 673 * @param[in] key The socket key identifier. 674 674 * @param[in] key_length The socket key length. 675 * @return sEOK on success.676 * @return sENOENT if the port is not already used.677 * @return sOther error codes as defined for the675 * @return EOK on success. 676 * @return ENOENT if the port is not already used. 677 * @return Other error codes as defined for the 678 678 * socket_port_add_core() function. 679 679 */ 680 680 int 681 socket_port_add(socket_ports_ refglobal_sockets, int port,682 socket_core_ refsocket, const char *key, size_t key_length)683 { 684 socket_port_ refsocket_port;681 socket_port_add(socket_ports_t *global_sockets, int port, 682 socket_core_t *socket, const char *key, size_t key_length) 683 { 684 socket_port_t *socket_port; 685 685 int rc; 686 686 -
uspace/lib/net/tl/tl_common.c
rb4c9c61 rfdbc3ff 64 64 * @param[in] addrlen The address length. 65 65 * @param[out] port The set port. 66 * @return sEOK on success.67 * @return sEINVAL if the address length does not match the address66 * @return EOK on success. 67 * @return EINVAL if the address length does not match the address 68 68 * family. 69 * @return sEAFNOSUPPORT if the address family is not supported.69 * @return EAFNOSUPPORT if the address family is not supported. 70 70 */ 71 71 int … … 120 120 int 121 121 tl_get_ip_packet_dimension(int ip_phone, 122 packet_dimensions_ refpacket_dimensions, device_id_t device_id,123 packet_dimension_ ref*packet_dimension)122 packet_dimensions_t *packet_dimensions, device_id_t device_id, 123 packet_dimension_t **packet_dimension) 124 124 { 125 125 int rc; … … 158 158 * @param[in] device_id The device identifier. 159 159 * @param[in] content The new maximum content size. 160 * @return sEOK on success.160 * @return EOK on success. 161 161 * @return ENOENT if the packet dimension is not cached. 162 162 */ 163 163 int 164 tl_update_ip_packet_dimension(packet_dimensions_ refpacket_dimensions,164 tl_update_ip_packet_dimension(packet_dimensions_t *packet_dimensions, 165 165 device_id_t device_id, size_t content) 166 166 { 167 packet_dimension_ refpacket_dimension;167 packet_dimension_t *packet_dimension; 168 168 169 169 packet_dimension = packet_dimensions_find(packet_dimensions, device_id); … … 196 196 * @param[in] addrlen The address length. 197 197 * @param[in] port The port to be set. 198 * @return sEOK on success.199 * @return sEINVAL if the address length does not match the address198 * @return EOK on success. 199 * @return EINVAL if the address length does not match the address 200 200 * family. 201 * @return sEAFNOSUPPORT if the address family is not supported.201 * @return EAFNOSUPPORT if the address family is not supported. 202 202 */ 203 203 int tl_set_address_port(struct sockaddr * addr, int addrlen, uint16_t port) … … 244 244 * @param[in] error The packet error reporting service. Prefixes the 245 245 * received packet. 246 * @return sEOK on success.247 * @return sENOENT if no packet may be sent.246 * @return EOK on success. 247 * @return ENOENT if no packet may be sent. 248 248 */ 249 249 int … … 280 280 * @param[in] addr The destination address. 281 281 * @param[in] addrlen The address length. 282 * @return sNumber of bytes received.283 * @return sEINVAL if the client does not send data.284 * @return sENOMEM if there is not enough memory left.285 * @return sOther error codes as defined for the282 * @return Number of bytes received. 283 * @return EINVAL if the client does not send data. 284 * @return ENOMEM if there is not enough memory left. 285 * @return Other error codes as defined for the 286 286 * async_data_read_finalize() function. 287 287 */ 288 288 int 289 tl_socket_read_packet_data(int packet_phone, packet_ refpacket, size_t prefix,290 const packet_dimension_ refdimension, const struct sockaddr *addr,289 tl_socket_read_packet_data(int packet_phone, packet_t *packet, size_t prefix, 290 const packet_dimension_t *dimension, const struct sockaddr *addr, 291 291 socklen_t addrlen) 292 292 {
Note:
See TracChangeset
for help on using the changeset viewer.
