Changeset 32eceb4f in mainline for uspace/lib
- Timestamp:
- 2010-11-20T22:30:36Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cb59f787
- Parents:
- 1b22bd4 (diff), 7e1f9b7 (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
- Files:
-
- 1 deleted
- 68 edited
-
c/arch/abs32le/src/stacktrace.c (modified) (1 diff)
-
c/arch/abs32le/src/tls.c (modified) (1 diff)
-
c/generic/adt/char_map.c (modified) (12 diffs)
-
c/generic/adt/dynamic_fifo.c (modified) (6 diffs)
-
c/generic/adt/measured_strings.c (modified) (10 diffs)
-
c/generic/async.c (modified) (2 diffs)
-
c/generic/io/klog.c (modified) (1 diff)
-
c/generic/net/icmp_api.c (modified) (1 diff)
-
c/generic/net/icmp_common.c (modified) (1 diff)
-
c/generic/net/inet.c (modified) (2 diffs)
-
c/generic/net/modules.c (modified) (4 diffs)
-
c/generic/net/packet.c (modified) (15 diffs)
-
c/generic/net/socket_client.c (modified) (30 diffs)
-
c/include/adt/char_map.h (modified) (2 diffs)
-
c/include/adt/dynamic_fifo.h (modified) (2 diffs)
-
c/include/adt/generic_char_map.h (modified) (9 diffs)
-
c/include/adt/generic_field.h (modified) (8 diffs)
-
c/include/adt/int_map.h (modified) (14 diffs)
-
c/include/adt/measured_strings.h (modified) (2 diffs)
-
c/include/net/device.h (modified) (1 diff)
-
c/include/net/modules.h (modified) (1 diff)
-
c/include/net/packet.h (modified) (3 diffs)
-
c/include/net/packet_header.h (modified) (1 diff)
-
c/include/unistd.h (modified) (1 diff)
-
net/adt/module_map.c (modified) (3 diffs)
-
net/generic/generic.c (modified) (3 diffs)
-
net/generic/net_checksum.c (modified) (6 diffs)
-
net/generic/net_remote.c (modified) (4 diffs)
-
net/generic/packet_client.c (modified) (10 diffs)
-
net/generic/packet_remote.c (modified) (8 diffs)
-
net/generic/protocol_map.c (modified) (5 diffs)
-
net/il/arp_remote.c (modified) (6 diffs)
-
net/il/il_interface.c (modified) (1 diff)
-
net/il/ip_client.c (modified) (10 diffs)
-
net/il/ip_remote.c (modified) (5 diffs)
-
net/include/adt/module_map.h (modified) (2 diffs)
-
net/include/arp_interface.h (modified) (1 diff)
-
net/include/generic.h (modified) (2 diffs)
-
net/include/icmp_client.h (modified) (1 diff)
-
net/include/icmp_header.h (modified) (2 diffs)
-
net/include/icmp_interface.h (modified) (1 diff)
-
net/include/il_interface.h (modified) (1 diff)
-
net/include/il_local.h (modified) (2 diffs)
-
net/include/ip_client.h (modified) (1 diff)
-
net/include/ip_header.h (modified) (2 diffs)
-
net/include/ip_interface.h (modified) (1 diff)
-
net/include/ip_remote.h (modified) (1 diff)
-
net/include/net_interface.h (modified) (1 diff)
-
net/include/netif_local.h (modified) (3 diffs)
-
net/include/netif_remote.h (modified) (1 diff)
-
net/include/nil_local.h (modified) (1 diff)
-
net/include/nil_remote.h (modified) (1 diff)
-
net/include/packet_client.h (modified) (3 diffs)
-
net/include/packet_remote.h (modified) (1 diff)
-
net/include/socket_core.h (modified) (3 diffs)
-
net/include/tl_common.h (modified) (1 diff)
-
net/include/tl_interface.h (modified) (1 diff)
-
net/include/tl_local.h (modified) (2 diffs)
-
net/netif/netif_local.c (modified) (6 diffs)
-
net/netif/netif_remote.c (modified) (3 diffs)
-
net/nil/nil_remote.c (modified) (1 diff)
-
net/tl/icmp_client.c (modified) (2 diffs)
-
net/tl/icmp_remote.c (modified) (4 diffs)
-
net/tl/socket_core.c (modified) (15 diffs)
-
net/tl/tl_common.c (modified) (6 diffs)
-
net/tl/tl_interface.c (modified) (1 diff)
-
packet/generic/packet_server.c (modified) (13 diffs)
-
packet/include/packet_local.h (deleted)
-
usb/src/hcdhubd.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/abs32le/src/stacktrace.c
r1b22bd4 r32eceb4f 56 56 uintptr_t stacktrace_fp_get(void) 57 57 { 58 return NULL;58 return (uintptr_t) NULL; 59 59 } 60 60 61 61 uintptr_t stacktrace_pc_get(void) 62 62 { 63 return NULL;63 return (uintptr_t) NULL; 64 64 } 65 65 -
uspace/lib/c/arch/abs32le/src/tls.c
r1b22bd4 r32eceb4f 46 46 uintptr_t __aeabi_read_tp(void) 47 47 { 48 return NULL;48 return (uintptr_t) NULL; 49 49 } 50 50 -
uspace/lib/c/generic/adt/char_map.c
r1b22bd4 r32eceb4f 60 60 * @param[in] value The integral value to be stored for the key character 61 61 * string. 62 * @return sEOK on success.63 * @return sENOMEM if there is not enough memory left.64 * @return sEEXIST if the key character string is already used.62 * @return EOK on success. 63 * @return ENOMEM if there is not enough memory left. 64 * @return EEXIST if the key character string is already used. 65 65 */ 66 66 static int 67 char_map_add_item(char_map_ refmap, const char *identifier, size_t length,67 char_map_add_item(char_map_t *map, const char *identifier, size_t length, 68 68 const int value) 69 69 { 70 70 if (map->next == (map->size - 1)) { 71 char_map_ ref*tmp;72 73 tmp = (char_map_ ref*) realloc(map->items,74 sizeof(char_map_ ref) * 2 * map->size);71 char_map_t **tmp; 72 73 tmp = (char_map_t **) realloc(map->items, 74 sizeof(char_map_t *) * 2 * map->size); 75 75 if (!tmp) 76 76 return ENOMEM; … … 80 80 } 81 81 82 map->items[map->next] = (char_map_ ref) malloc(sizeof(char_map_t));82 map->items[map->next] = (char_map_t *) malloc(sizeof(char_map_t)); 83 83 if (!map->items[map->next]) 84 84 return ENOMEM; … … 107 107 * 108 108 * @param[in] map The character string to integer map. 109 * @return sTRUE if the map is valid.110 * @return sFALSE otherwise.111 */ 112 static int char_map_is_valid(const char_map_ refmap)109 * @return TRUE if the map is valid. 110 * @return FALSE otherwise. 111 */ 112 static int char_map_is_valid(const char_map_t *map) 113 113 { 114 114 return map && (map->magic == CHAR_MAP_MAGIC_VALUE); … … 127 127 * @param[in] value The integral value to be stored for the key character 128 128 * string. 129 * @return sEOK on success.130 * @return sEINVAL if the map is not valid.131 * @return sEINVAL if the identifier parameter is NULL.132 * @return sEINVAL if the length parameter zero (0) and the129 * @return EOK on success. 130 * @return EINVAL if the map is not valid. 131 * @return EINVAL if the identifier parameter is NULL. 132 * @return EINVAL if the length parameter zero (0) and the 133 133 * identifier parameter is an empty character string (the 134 134 * first character is the terminating zero ('\0') 135 135 * character. 136 * @return sEEXIST if the key character string is already used.137 * @return sOther error codes as defined for the136 * @return EEXIST if the key character string is already used. 137 * @return Other error codes as defined for the 138 138 * char_map_add_item() function. 139 139 */ 140 140 int 141 char_map_add(char_map_ refmap, const char *identifier, size_t length,141 char_map_add(char_map_t *map, const char *identifier, size_t length, 142 142 const int value) 143 143 { … … 172 172 * @param[in,out] map The character string to integer map. 173 173 */ 174 void char_map_destroy(char_map_ refmap)174 void char_map_destroy(char_map_t *map) 175 175 { 176 176 if (char_map_is_valid(map)) { … … 196 196 * zero (0) which means that the string is processed until 197 197 * the terminating zero ('\0') character is found. 198 * @return sThe node holding the integral value assigned to the key198 * @return The node holding the integral value assigned to the key 199 199 * character string. 200 * @return sNULL if the key is not assigned a node.201 */ 202 static char_map_ ref203 char_map_find_node(const char_map_ refmap, const char *identifier,200 * @return NULL if the key is not assigned a node. 201 */ 202 static char_map_t * 203 char_map_find_node(const char_map_t *map, const char *identifier, 204 204 size_t length) 205 205 { … … 224 224 } 225 225 226 return map;226 return (char_map_t *) map; 227 227 } 228 228 … … 239 239 * zero (0) which means that the string is processed until 240 240 * the terminating zero ('\0') character is found. 241 * @return sThe integral value assigned to the key character string.242 * @return sCHAR_MAP_NULL if the key is not assigned a value.243 */ 244 int char_map_exclude(char_map_ refmap, const char *identifier, size_t length)245 { 246 char_map_ refnode;241 * @return The integral value assigned to the key character string. 242 * @return CHAR_MAP_NULL if the key is not assigned a value. 243 */ 244 int char_map_exclude(char_map_t *map, const char *identifier, size_t length) 245 { 246 char_map_t *node; 247 247 248 248 node = char_map_find_node(map, identifier, length); … … 267 267 * zero (0) which means that the string is processed until 268 268 * the terminating zero ('\0') character is found. 269 * @return sThe integral value assigned to the key character string.270 * @return sCHAR_MAP_NULL if the key is not assigned a value.271 */ 272 int char_map_find(const char_map_ refmap, const char *identifier, size_t length)273 { 274 char_map_ refnode;269 * @return The integral value assigned to the key character string. 270 * @return CHAR_MAP_NULL if the key is not assigned a value. 271 */ 272 int char_map_find(const char_map_t *map, const char *identifier, size_t length) 273 { 274 char_map_t *node; 275 275 276 276 node = char_map_find_node(map, identifier, length); … … 281 281 * 282 282 * @param[in,out] map The character string to integer map. 283 * @return sEOK on success.284 * @return sEINVAL if the map parameter is NULL.285 * @return sENOMEM if there is not enough memory left.286 */ 287 int char_map_initialize(char_map_ refmap)283 * @return EOK on success. 284 * @return EINVAL if the map parameter is NULL. 285 * @return ENOMEM if there is not enough memory left. 286 */ 287 int char_map_initialize(char_map_t *map) 288 288 { 289 289 if (!map) … … 295 295 map->next = 0; 296 296 297 map->items = malloc(sizeof(char_map_ ref) * map->size);297 map->items = malloc(sizeof(char_map_t *) * map->size); 298 298 if (!map->items) { 299 299 map->magic = 0; … … 319 319 * @param[in] value The integral value to be stored for the key character 320 320 * string. 321 * @return sEOK on success.322 * @return sEINVAL if the map is not valid.323 * @return sEINVAL if the identifier parameter is NULL.324 * @return sEINVAL if the length parameter zero (0) and the321 * @return EOK on success. 322 * @return EINVAL if the map is not valid. 323 * @return EINVAL if the identifier parameter is NULL. 324 * @return EINVAL if the length parameter zero (0) and the 325 325 * identifier parameter is an empty character string (the 326 326 * first character is the terminating zero ('\0) character. 327 * @return sEEXIST if the key character string is already used.328 * @return sOther error codes as defined for the char_map_add_item()327 * @return EEXIST if the key character string is already used. 328 * @return Other error codes as defined for the char_map_add_item() 329 329 * function. 330 330 */ 331 331 int 332 char_map_update(char_map_ refmap, const char *identifier, const size_t length,332 char_map_update(char_map_t *map, const char *identifier, const size_t length, 333 333 const int value) 334 334 { 335 char_map_ refnode;335 char_map_t *node; 336 336 337 337 node = char_map_find_node(map, identifier, length); -
uspace/lib/c/generic/adt/dynamic_fifo.c
r1b22bd4 r32eceb4f 56 56 * 57 57 * @param[in] fifo The dynamic queue. 58 * @return sTRUE if the queue is valid.59 * @return sFALSE otherwise.60 */ 61 static int dyn_fifo_is_valid(dyn_fifo_ reffifo)58 * @return TRUE if the queue is valid. 59 * @return FALSE otherwise. 60 */ 61 static int dyn_fifo_is_valid(dyn_fifo_t *fifo) 62 62 { 63 63 return fifo && (fifo->magic_value == DYN_FIFO_MAGIC_VALUE); … … 68 68 * @param[in,out] fifo The dynamic queue. 69 69 * @param[in] size The initial queue size. 70 * @return sEOK on success.71 * @return sEINVAL if the queue is not valid.72 * @return sEBADMEM if the fifo parameter is NULL.73 * @return sENOMEM if there is not enough memory left.74 */ 75 int dyn_fifo_initialize(dyn_fifo_ reffifo, int size)70 * @return EOK on success. 71 * @return EINVAL if the queue is not valid. 72 * @return EBADMEM if the fifo parameter is NULL. 73 * @return ENOMEM if there is not enough memory left. 74 */ 75 int dyn_fifo_initialize(dyn_fifo_t *fifo, int size) 76 76 { 77 77 if (!fifo) … … 100 100 * this limit. May be zero or negative to indicate no 101 101 * limit. 102 * @return sEOK on success.103 * @return sEINVAL if the queue is not valid.104 * @return sENOMEM if there is not enough memory left.105 */ 106 int dyn_fifo_push(dyn_fifo_ reffifo, int value, int max_size)102 * @return EOK on success. 103 * @return EINVAL if the queue is not valid. 104 * @return ENOMEM if there is not enough memory left. 105 */ 106 int dyn_fifo_push(dyn_fifo_t *fifo, int value, int max_size) 107 107 { 108 108 int *new_items; … … 150 150 * 151 151 * @param[in,out] fifo The dynamic queue. 152 * @return sValue of the first item in the queue.153 * @return sEINVAL if the queue is not valid.154 * @return sENOENT if the queue is empty.155 */ 156 int dyn_fifo_pop(dyn_fifo_ reffifo)152 * @return Value of the first item in the queue. 153 * @return EINVAL if the queue is not valid. 154 * @return ENOENT if the queue is empty. 155 */ 156 int dyn_fifo_pop(dyn_fifo_t *fifo) 157 157 { 158 158 int value; … … 172 172 * 173 173 * @param[in,out] fifo The dynamic queue. 174 * @return siValue of the first item in the queue.175 * @return sEINVAL if the queue is not valid.176 * @return sENOENT if the queue is empty.177 */ 178 int dyn_fifo_value(dyn_fifo_ reffifo)174 * @return Value of the first item in the queue. 175 * @return EINVAL if the queue is not valid. 176 * @return ENOENT if the queue is empty. 177 */ 178 int dyn_fifo_value(dyn_fifo_t *fifo) 179 179 { 180 180 if (!dyn_fifo_is_valid(fifo)) … … 190 190 * 191 191 * @param[in,out] fifo The dynamic queue. 192 * @return sEOK on success.193 * @return sEINVAL if the queue is not valid.194 */ 195 int dyn_fifo_destroy(dyn_fifo_ reffifo)192 * @return EOK on success. 193 * @return EINVAL if the queue is not valid. 194 */ 195 int dyn_fifo_destroy(dyn_fifo_t *fifo) 196 196 { 197 197 if (!dyn_fifo_is_valid(fifo)) -
uspace/lib/c/generic/adt/measured_strings.c
r1b22bd4 r32eceb4f 55 55 * appended with the terminating zero ('\0') character 56 56 * otherwise. 57 * @return sThe new bundled character string with measured length.58 * @return sNULL if there is not enough memory left.59 */ 60 measured_string_ ref57 * @return The new bundled character string with measured length. 58 * @return NULL if there is not enough memory left. 59 */ 60 measured_string_t * 61 61 measured_string_create_bulk(const char *string, size_t length) 62 62 { 63 measured_string_ refnew;63 measured_string_t *new; 64 64 65 65 if (length == 0) { … … 67 67 length++; 68 68 } 69 new = (measured_string_ ref) malloc(sizeof(measured_string_t) +69 new = (measured_string_t *) malloc(sizeof(measured_string_t) + 70 70 (sizeof(char) * (length + 1))); 71 71 if (!new) … … 84 84 * 85 85 * @param[in] source The source measured string to be copied. 86 * @return sThe copy of the given measured string.87 * @return sNULL if the source parameter is NULL.88 * @return sNULL if there is not enough memory left.89 */ 90 measured_string_ ref measured_string_copy(measured_string_refsource)91 { 92 measured_string_ refnew;86 * @return The copy of the given measured string. 87 * @return NULL if the source parameter is NULL. 88 * @return NULL if there is not enough memory left. 89 */ 90 measured_string_t *measured_string_copy(measured_string_t *source) 91 { 92 measured_string_t *new; 93 93 94 94 if (!source) 95 95 return NULL; 96 96 97 new = (measured_string_ ref) malloc(sizeof(measured_string_t));97 new = (measured_string_t *) malloc(sizeof(measured_string_t)); 98 98 if (new) { 99 99 new->value = (char *) malloc(source->length + 1); … … 120 120 * actual character strings. 121 121 * @param[in] count The size of the measured strings array. 122 * @return sEOK on success.123 * @return sEINVAL if the strings or data parameter is NULL.124 * @return sEINVAL if the count parameter is zero (0).125 * @return sEINVAL if the sent array differs in size.126 * @return sEINVAL if there is inconsistency in sent measured122 * @return EOK on success. 123 * @return EINVAL if the strings or data parameter is NULL. 124 * @return EINVAL if the count parameter is zero (0). 125 * @return EINVAL if the sent array differs in size. 126 * @return EINVAL if there is inconsistency in sent measured 127 127 * strings' lengths (should not occur). 128 * @return sENOMEM if there is not enough memory left.129 * @return sOther error codes as defined for the128 * @return ENOMEM if there is not enough memory left. 129 * @return Other error codes as defined for the 130 130 * async_data_write_finalize() function. 131 131 */ 132 132 int 133 measured_strings_receive(measured_string_ ref*strings, char **data,133 measured_strings_receive(measured_string_t **strings, char **data, 134 134 size_t count) 135 135 { … … 166 166 (*data)[lengths[count] - 1] = '\0'; 167 167 168 *strings = (measured_string_ ref) malloc(sizeof(measured_string_t) *168 *strings = (measured_string_t *) malloc(sizeof(measured_string_t) * 169 169 count); 170 170 if (!*strings) { … … 209 209 * @param[in] strings The measured strings array to be processed. 210 210 * @param[in] count The measured strings array size. 211 * @return sThe computed sizes array.212 * @return sNULL if there is not enough memory left.213 */ 214 static size_t *prepare_lengths(const measured_string_ refstrings, size_t count)211 * @return The computed sizes array. 212 * @return NULL if there is not enough memory left. 213 */ 214 static size_t *prepare_lengths(const measured_string_t *strings, size_t count) 215 215 { 216 216 size_t *lengths; … … 238 238 * @param[in] strings The measured strings array to be transferred. 239 239 * @param[in] count The measured strings array size. 240 * @return sEOK on success.241 * @return sEINVAL if the strings parameter is NULL.242 * @return sEINVAL if the count parameter is zero (0).243 * @return sEINVAL if the calling module does not accept the given240 * @return EOK on success. 241 * @return EINVAL if the strings parameter is NULL. 242 * @return EINVAL if the count parameter is zero (0). 243 * @return EINVAL if the calling module does not accept the given 244 244 * array size. 245 * @return sEINVAL if there is inconsistency in sent measured245 * @return EINVAL if there is inconsistency in sent measured 246 246 * strings' lengths (should not occur). 247 * @return sOther error codes as defined for the247 * @return Other error codes as defined for the 248 248 * async_data_read_finalize() function. 249 249 */ 250 int measured_strings_reply(const measured_string_ refstrings, size_t count)250 int measured_strings_reply(const measured_string_t *strings, size_t count) 251 251 { 252 252 size_t *lengths; … … 302 302 * actual character strings. 303 303 * @param[in] count The size of the measured strings array. 304 * @return sEOK on success.305 * @return sEINVAL if the strings or data parameter is NULL.306 * @return sEINVAL if the phone or count parameter is not positive.307 * @return sEINVAL if the sent array differs in size.308 * @return sENOMEM if there is not enough memory left.309 * @return sOther error codes as defined for the304 * @return EOK on success. 305 * @return EINVAL if the strings or data parameter is NULL. 306 * @return EINVAL if the phone or count parameter is not positive. 307 * @return EINVAL if the sent array differs in size. 308 * @return ENOMEM if there is not enough memory left. 309 * @return Other error codes as defined for the 310 310 * async_data_read_start() function. 311 311 */ 312 312 int 313 measured_strings_return(int phone, measured_string_ ref*strings, char **data,313 measured_strings_return(int phone, measured_string_t **strings, char **data, 314 314 size_t count) 315 315 { … … 339 339 } 340 340 341 *strings = (measured_string_ ref) malloc(sizeof(measured_string_t) *341 *strings = (measured_string_t *) malloc(sizeof(measured_string_t) * 342 342 count); 343 343 if (!*strings) { … … 378 378 * @param[in] strings The measured strings array to be transferred. 379 379 * @param[in] count The measured strings array size. 380 * @return sEOK on success.381 * @return sEINVAL if the strings parameter is NULL.382 * @return sEINVAL if the phone or count parameter is not positive.383 * @return sOther error codes as defined for the380 * @return EOK on success. 381 * @return EINVAL if the strings parameter is NULL. 382 * @return EINVAL if the phone or count parameter is not positive. 383 * @return Other error codes as defined for the 384 384 * async_data_write_start() function. 385 385 */ 386 386 int 387 measured_strings_send(int phone, const measured_string_ refstrings,387 measured_strings_send(int phone, const measured_string_t *strings, 388 388 size_t count) 389 389 { -
uspace/lib/c/generic/async.c
r1b22bd4 r32eceb4f 536 536 if (callid) 537 537 ipc_answer_0(callid, ENOMEM); 538 return NULL;538 return (uintptr_t) NULL; 539 539 } 540 540 … … 556 556 if (callid) 557 557 ipc_answer_0(callid, ENOMEM); 558 return NULL;558 return (uintptr_t) NULL; 559 559 } 560 560 -
uspace/lib/c/generic/io/klog.c
r1b22bd4 r32eceb4f 52 52 void klog_update(void) 53 53 { 54 (void) __SYSCALL3(SYS_KLOG, 1, NULL, 0);54 (void) __SYSCALL3(SYS_KLOG, 1, (uintptr_t) NULL, 0); 55 55 } 56 56 -
uspace/lib/c/generic/net/icmp_api.c
r1b22bd4 r32eceb4f 66 66 * @param[in] addr The target host address. 67 67 * @param[in] addrlen The torget host address length. 68 * @return sICMP_ECHO on success.69 * @return sETIMEOUT if the reply has not arrived before the68 * @return ICMP_ECHO on success. 69 * @return ETIMEOUT if the reply has not arrived before the 70 70 * timeout. 71 * @return sICMP type of the received error notification.72 * @return sEINVAL if the addrlen parameter is less or equal to71 * @return ICMP type of the received error notification. 72 * @return EINVAL if the addrlen parameter is less or equal to 73 73 * zero. 74 * @return sENOMEM if there is not enough memory left.75 * @return sEPARTY if there was an internal error.74 * @return ENOMEM if there is not enough memory left. 75 * @return EPARTY if there was an internal error. 76 76 */ 77 77 int -
uspace/lib/c/generic/net/icmp_common.c
r1b22bd4 r32eceb4f 50 50 * @param[in] timeout The connection timeout in microseconds. No timeout if 51 51 * set to zero. 52 * @return sThe ICMP module phone on success.53 * @return sETIMEOUT if the connection timeouted.52 * @return The ICMP module phone on success. 53 * @return ETIMEOUT if the connection timeouted. 54 54 */ 55 55 int icmp_connect_module(services_t service, suseconds_t timeout) -
uspace/lib/c/generic/net/inet.c
r1b22bd4 r32eceb4f 51 51 * @param[out] address The character buffer to be filled. 52 52 * @param[in] length The buffer length. 53 * @return sEOK on success.54 * @return sEINVAL if the data or address parameter is NULL.55 * @return sENOMEM if the character buffer is not long enough.56 * @return sENOTSUP if the address family is not supported.53 * @return EOK on success. 54 * @return EINVAL if the data or address parameter is NULL. 55 * @return ENOMEM if the character buffer is not long enough. 56 * @return ENOTSUP if the address family is not supported. 57 57 */ 58 58 int … … 101 101 * @param[in] address The character buffer to be parsed. 102 102 * @param[out] data The address data to be filled. 103 * @return sEOK on success.104 * @return sEINVAL if the data parameter is NULL.105 * @return sENOENT if the address parameter is NULL.106 * @return sENOTSUP if the address family is not supported.103 * @return EOK on success. 104 * @return EINVAL if the data parameter is NULL. 105 * @return ENOENT if the address parameter is NULL. 106 * @return ENOTSUP if the address family is not supported. 107 107 */ 108 108 int inet_pton(uint16_t family, const char *address, uint8_t *data) -
uspace/lib/c/generic/net/modules.c
r1b22bd4 r32eceb4f 159 159 * 160 160 * @param[in] need The needed module service. 161 * @return sThe phone of the needed service.161 * @return The phone of the needed service. 162 162 */ 163 163 int connect_to_service(services_t need) … … 171 171 * @param[in] timeout The connection timeout in microseconds. No timeout if 172 172 * set to zero (0). 173 * @return sThe phone of the needed service.174 * @return sETIMEOUT if the connection timeouted.173 * @return The phone of the needed service. 174 * @return ETIMEOUT if the connection timeouted. 175 175 */ 176 176 int connect_to_service_timeout(services_t need, suseconds_t timeout) … … 204 204 * @param[out] data The data buffer to be filled. 205 205 * @param[out] length The buffer length. 206 * @return sEOK on success.207 * @return sEBADMEM if the data or the length parameter is NULL.208 * @return sEINVAL if the client does not send data.209 * @return sENOMEM if there is not enough memory left.210 * @return sOther error codes as defined for the206 * @return EOK on success. 207 * @return EBADMEM if the data or the length parameter is NULL. 208 * @return EINVAL if the client does not send data. 209 * @return ENOMEM if there is not enough memory left. 210 * @return Other error codes as defined for the 211 211 * async_data_write_finalize() function. 212 212 */ … … 242 242 * @param[in] data The data buffer to be sent. 243 243 * @param[in] data_length The buffer length. 244 * @return sEOK on success.245 * @return sEINVAL if the client does not expect the data.246 * @return sEOVERFLOW if the client does not expect all the data.244 * @return EOK on success. 245 * @return EINVAL if the client does not expect the data. 246 * @return EOVERFLOW if the client does not expect all the data. 247 247 * Only partial data are transfered. 248 * @return sOther error codes as defined for the248 * @return Other error codes as defined for the 249 249 * async_data_read_finalize() function. 250 250 */ -
uspace/lib/c/generic/net/packet.c
r1b22bd4 r32eceb4f 62 62 63 63 /** Type definition of the packet map page. */ 64 typedef packet_t packet_map_t[PACKET_MAP_SIZE]; 65 66 /** Type definition of the packet map page pointer. */ 67 typedef packet_map_t * packet_map_ref; 64 typedef packet_t *packet_map_t[PACKET_MAP_SIZE]; 68 65 69 66 /** Packet map. … … 85 82 /** Initializes the packet map. 86 83 * 87 * @return sEOK on success.88 * @return sENOMEM if there is not enough memory left.84 * @return EOK on success. 85 * @return ENOMEM if there is not enough memory left. 89 86 */ 90 87 int pm_init(void) … … 104 101 * 105 102 * @param[in] packet_id The packet identifier to be found. 106 * @return sThe found packet reference.107 * @return sNULL if the mapping does not exist.108 */ 109 packet_t pm_find(packet_id_t packet_id)110 { 111 packet_map_ refmap;112 packet_t packet;103 * @return The found packet reference. 104 * @return NULL if the mapping does not exist. 105 */ 106 packet_t *pm_find(packet_id_t packet_id) 107 { 108 packet_map_t *map; 109 packet_t *packet; 113 110 114 111 if (!packet_id) … … 133 130 * 134 131 * @param[in] packet The packet to be remembered. 135 * @return sEOK on success.136 * @return sEINVAL if the packet is not valid.137 * @return sEINVAL if the packet map is not initialized.138 * @return sENOMEM if there is not enough memory left.139 */ 140 int pm_add(packet_t packet)141 { 142 packet_map_ refmap;132 * @return EOK on success. 133 * @return EINVAL if the packet is not valid. 134 * @return EINVAL if the packet map is not initialized. 135 * @return ENOMEM if there is not enough memory left. 136 */ 137 int pm_add(packet_t *packet) 138 { 139 packet_map_t *map; 143 140 int rc; 144 141 … … 154 151 } else { 155 152 do { 156 map = (packet_map_ ref) malloc(sizeof(packet_map_t));153 map = (packet_map_t *) malloc(sizeof(packet_map_t)); 157 154 if (!map) { 158 155 fibril_rwlock_write_unlock(&pm_globals.lock); … … 180 177 int count; 181 178 int index; 182 packet_map_ refmap;183 packet_t packet;179 packet_map_t *map; 180 packet_t *packet; 184 181 185 182 fibril_rwlock_write_lock(&pm_globals.lock); … … 208 205 * @param[in] order The packet order value. 209 206 * @param[in] metric The metric value of the packet. 210 * @return sEOK on success.211 * @return sEINVAL if the first parameter is NULL.212 * @return sEINVAL if the packet is not valid.213 */ 214 int pq_add(packet_t * first, packet_tpacket, size_t order, size_t metric)215 { 216 packet_t item;207 * @return EOK on success. 208 * @return EINVAL if the first parameter is NULL. 209 * @return EINVAL if the packet is not valid. 210 */ 211 int pq_add(packet_t **first, packet_t *packet, size_t order, size_t metric) 212 { 213 packet_t *item; 217 214 218 215 if (!first || !packet_is_valid(packet)) … … 252 249 * @param[in] first The first packet of the queue. 253 250 * @param[in] order The packet order value. 254 * @return sThe packet with the given order.255 * @return sNULL if the first packet is not valid.256 * @return sNULL if the packet is not found.257 */ 258 packet_t pq_find(packet_tpacket, size_t order)259 { 260 packet_t item;251 * @return The packet with the given order. 252 * @return NULL if the first packet is not valid. 253 * @return NULL if the packet is not found. 254 */ 255 packet_t *pq_find(packet_t *packet, size_t order) 256 { 257 packet_t *item; 261 258 262 259 if (!packet_is_valid(packet)) … … 278 275 * @param[in] packet The packet in the queue. 279 276 * @param[in] new_packet The new packet to be inserted. 280 * @return sEOK on success.281 * @return sEINVAL if etiher of the packets is invalid.282 */ 283 int pq_insert_after(packet_t packet, packet_tnew_packet)284 { 285 packet_t item;277 * @return EOK on success. 278 * @return EINVAL if etiher of the packets is invalid. 279 */ 280 int pq_insert_after(packet_t *packet, packet_t *new_packet) 281 { 282 packet_t *item; 286 283 287 284 if (!packet_is_valid(packet) || !packet_is_valid(new_packet)) … … 301 298 * 302 299 * @param[in] packet The packet to be detached. 303 * @return sThe next packet in the queue. If the packet is the first300 * @return The next packet in the queue. If the packet is the first 304 301 * one of the queue, this becomes the new first one. 305 * @return sNULL if there is no packet left.306 * @return sNULL if the packet is not valid.307 */ 308 packet_t pq_detach(packet_tpacket)309 { 310 packet_t next;311 packet_t previous;302 * @return NULL if there is no packet left. 303 * @return NULL if the packet is not valid. 304 */ 305 packet_t *pq_detach(packet_t *packet) 306 { 307 packet_t *next; 308 packet_t *previous; 312 309 313 310 if (!packet_is_valid(packet)) … … 331 328 * @param[in] order The packet order value. 332 329 * @param[in] metric The metric value of the packet. 333 * @return sEOK on success.334 * @return sEINVAL if the packet is invalid.335 */ 336 int pq_set_order(packet_t packet, size_t order, size_t metric)330 * @return EOK on success. 331 * @return EINVAL if the packet is invalid. 332 */ 333 int pq_set_order(packet_t *packet, size_t order, size_t metric) 337 334 { 338 335 if (!packet_is_valid(packet)) … … 349 346 * @param[out] order The packet order value. 350 347 * @param[out] metric The metric value of the packet. 351 * @return sEOK on success.352 * @return sEINVAL if the packet is invalid.353 */ 354 int pq_get_order(packet_t packet, size_t *order, size_t *metric)348 * @return EOK on success. 349 * @return EINVAL if the packet is invalid. 350 */ 351 int pq_get_order(packet_t *packet, size_t *order, size_t *metric) 355 352 { 356 353 if (!packet_is_valid(packet)) … … 375 372 * packets after its detachment. 376 373 */ 377 void pq_destroy(packet_t first, void (*packet_release)(packet_tpacket))378 { 379 packet_t actual;380 packet_t next;374 void pq_destroy(packet_t *first, void (*packet_release)(packet_t *packet)) 375 { 376 packet_t *actual; 377 packet_t *next; 381 378 382 379 actual = first; … … 394 391 * 395 392 * @param[in] packet The packet queue member. 396 * @return sThe next packet in the queue.397 * @return sNULL if there is no next packet.398 * @return sNULL if the packet is not valid.399 */ 400 packet_t pq_next(packet_tpacket)393 * @return The next packet in the queue. 394 * @return NULL if there is no next packet. 395 * @return NULL if the packet is not valid. 396 */ 397 packet_t *pq_next(packet_t *packet) 401 398 { 402 399 if (!packet_is_valid(packet)) … … 409 406 * 410 407 * @param[in] packet The packet queue member. 411 * @return sThe previous packet in the queue.412 * @return sNULL if there is no previous packet.413 * @return sNULL if the packet is not valid.414 */ 415 packet_t pq_previous(packet_tpacket)408 * @return The previous packet in the queue. 409 * @return NULL if there is no previous packet. 410 * @return NULL if the packet is not valid. 411 */ 412 packet_t *pq_previous(packet_t *packet) 416 413 { 417 414 if (!packet_is_valid(packet)) -
uspace/lib/c/generic/net/socket_client.c
r1b22bd4 r32eceb4f 79 79 typedef struct socket socket_t; 80 80 81 /** Type definition of the socket specific data pointer.82 * @see socket83 */84 typedef socket_t *socket_ref;85 86 81 /** Socket specific data. 87 82 * … … 162 157 163 158 /** Active sockets. */ 164 sockets_ refsockets;159 sockets_t *sockets; 165 160 166 161 /** Safety lock. … … 183 178 /** Returns the active sockets. 184 179 * 185 * @return sThe active sockets.186 */ 187 static sockets_ refsocket_get_sockets(void)180 * @return The active sockets. 181 */ 182 static sockets_t *socket_get_sockets(void) 188 183 { 189 184 if (!socket_globals.sockets) { 190 185 socket_globals.sockets = 191 (sockets_ ref) malloc(sizeof(sockets_t));186 (sockets_t *) malloc(sizeof(sockets_t)); 192 187 if (!socket_globals.sockets) 193 188 return NULL; … … 213 208 ipc_callid_t callid; 214 209 ipc_call_t call; 215 socket_ refsocket;210 socket_t *socket; 216 211 int rc; 217 212 … … 291 286 * Connects to the TCP module if necessary. 292 287 * 293 * @return sThe TCP module phone.294 * @return sOther error codes as defined for the288 * @return The TCP module phone. 289 * @return Other error codes as defined for the 295 290 * bind_service_timeout() function. 296 291 */ … … 310 305 * Connects to the UDP module if necessary. 311 306 * 312 * @return sThe UDP module phone.313 * @return sOther error codes as defined for the307 * @return The UDP module phone. 308 * @return Other error codes as defined for the 314 309 * bind_service_timeout() function. 315 310 */ … … 327 322 /** Tries to find a new free socket identifier. 328 323 * 329 * @return sThe new socket identifier.330 * @return sELIMIT if there is no socket identifier available.324 * @return The new socket identifier. 325 * @return ELIMIT if there is no socket identifier available. 331 326 */ 332 327 static int socket_generate_new_id(void) 333 328 { 334 sockets_ refsockets;329 sockets_t *sockets; 335 330 int socket_id = 0; 336 331 int count; … … 372 367 */ 373 368 static void 374 socket_initialize(socket_ refsocket, int socket_id, int phone,369 socket_initialize(socket_t *socket, int socket_id, int phone, 375 370 services_t service) 376 371 { … … 392 387 * @param[in] type Socket type. 393 388 * @param[in] protocol Socket protocol. 394 * @return sThe socket identifier on success.395 * @return sEPFNOTSUPPORT if the protocol family is not supported.396 * @return sESOCKNOTSUPPORT if the socket type is not supported.397 * @return sEPROTONOSUPPORT if the protocol is not supported.398 * @return sENOMEM if there is not enough memory left.399 * @return sELIMIT if there was not a free socket identifier found389 * @return The socket identifier on success. 390 * @return EPFNOTSUPPORT if the protocol family is not supported. 391 * @return ESOCKNOTSUPPORT if the socket type is not supported. 392 * @return EPROTONOSUPPORT if the protocol is not supported. 393 * @return ENOMEM if there is not enough memory left. 394 * @return ELIMIT if there was not a free socket identifier found 400 395 * this time. 401 * @return sOther error codes as defined for the NET_SOCKET message.402 * @return sOther error codes as defined for the396 * @return Other error codes as defined for the NET_SOCKET message. 397 * @return Other error codes as defined for the 403 398 * bind_service_timeout() function. 404 399 */ 405 400 int socket(int domain, int type, int protocol) 406 401 { 407 socket_ refsocket;402 socket_t *socket; 408 403 int phone; 409 404 int socket_id; … … 463 458 464 459 // create a new socket structure 465 socket = (socket_ ref) malloc(sizeof(socket_t));460 socket = (socket_t *) malloc(sizeof(socket_t)); 466 461 if (!socket) 467 462 return ENOMEM; … … 514 509 * @param[in] data The data to be sent. 515 510 * @param[in] datalength The data length. 516 * @return sEOK on success.517 * @return sENOTSOCK if the socket is not found.518 * @return sEBADMEM if the data parameter is NULL.519 * @return sNO_DATA if the datalength parameter is zero (0).520 * @return sOther error codes as defined for the spcific message.511 * @return EOK on success. 512 * @return ENOTSOCK if the socket is not found. 513 * @return EBADMEM if the data parameter is NULL. 514 * @return NO_DATA if the datalength parameter is zero (0). 515 * @return Other error codes as defined for the spcific message. 521 516 */ 522 517 static int … … 524 519 const void *data, size_t datalength) 525 520 { 526 socket_ refsocket;521 socket_t *socket; 527 522 aid_t message_id; 528 523 ipcarg_t result; … … 559 554 * @param[in] my_addr The port address. 560 555 * @param[in] addrlen The address length. 561 * @return sEOK on success.562 * @return sENOTSOCK if the socket is not found.563 * @return sEBADMEM if the my_addr parameter is NULL.564 * @return sNO_DATA if the addlen parameter is zero.565 * @return sOther error codes as defined for the NET_SOCKET_BIND556 * @return EOK on success. 557 * @return ENOTSOCK if the socket is not found. 558 * @return EBADMEM if the my_addr parameter is NULL. 559 * @return NO_DATA if the addlen parameter is zero. 560 * @return Other error codes as defined for the NET_SOCKET_BIND 566 561 * message. 567 562 */ … … 580 575 * @param[in] socket_id Socket identifier. 581 576 * @param[in] backlog The maximum number of waiting sockets to be accepted. 582 * @return sEOK on success.583 * @return sEINVAL if the backlog parameter is not positive (<=0).584 * @return sENOTSOCK if the socket is not found.585 * @return sOther error codes as defined for the NET_SOCKET_LISTEN577 * @return EOK on success. 578 * @return EINVAL if the backlog parameter is not positive (<=0). 579 * @return ENOTSOCK if the socket is not found. 580 * @return Other error codes as defined for the NET_SOCKET_LISTEN 586 581 * message. 587 582 */ 588 583 int listen(int socket_id, int backlog) 589 584 { 590 socket_ refsocket;585 socket_t *socket; 591 586 int result; 592 587 … … 618 613 * @param[out] cliaddr The remote client address. 619 614 * @param[in] addrlen The address length. 620 * @return sEOK on success.621 * @return sEBADMEM if the cliaddr or addrlen parameter is NULL.622 * @return sEINVAL if the backlog parameter is not positive (<=0).623 * @return sENOTSOCK if the socket is not found.624 * @return sOther error codes as defined for the NET_SOCKET_ACCEPT615 * @return EOK on success. 616 * @return EBADMEM if the cliaddr or addrlen parameter is NULL. 617 * @return EINVAL if the backlog parameter is not positive (<=0). 618 * @return ENOTSOCK if the socket is not found. 619 * @return Other error codes as defined for the NET_SOCKET_ACCEPT 625 620 * message. 626 621 */ 627 622 int accept(int socket_id, struct sockaddr * cliaddr, socklen_t * addrlen) 628 623 { 629 socket_ refsocket;630 socket_ refnew_socket;624 socket_t *socket; 625 socket_t *new_socket; 631 626 aid_t message_id; 632 627 ipcarg_t ipc_result; … … 661 656 662 657 // create a new scoket 663 new_socket = (socket_ ref) malloc(sizeof(socket_t));658 new_socket = (socket_t *) malloc(sizeof(socket_t)); 664 659 if (!new_socket) { 665 660 fibril_mutex_unlock(&socket->accept_lock); … … 721 716 * @param[in] serv_addr The remote server address. 722 717 * @param[in] addrlen The address length. 723 * @return sEOK on success.724 * @return sEBADMEM if the serv_addr parameter is NULL.725 * @return sNO_DATA if the addlen parameter is zero.726 * @return sENOTSOCK if the socket is not found.727 * @return sOther error codes as defined for the NET_SOCKET_CONNECT718 * @return EOK on success. 719 * @return EBADMEM if the serv_addr parameter is NULL. 720 * @return NO_DATA if the addlen parameter is zero. 721 * @return ENOTSOCK if the socket is not found. 722 * @return Other error codes as defined for the NET_SOCKET_CONNECT 728 723 * message. 729 724 */ … … 745 740 * @param[in] socket The socket to be destroyed. 746 741 */ 747 static void socket_destroy(socket_ refsocket)742 static void socket_destroy(socket_t *socket) 748 743 { 749 744 int accepted_id; … … 761 756 * 762 757 * @param[in] socket_id Socket identifier. 763 * @return sEOK on success.764 * @return sENOTSOCK if the socket is not found.765 * @return sEINPROGRESS if there is another blocking function in758 * @return EOK on success. 759 * @return ENOTSOCK if the socket is not found. 760 * @return EINPROGRESS if there is another blocking function in 766 761 * progress. 767 * @return sOther error codes as defined for the NET_SOCKET_CLOSE762 * @return Other error codes as defined for the NET_SOCKET_CLOSE 768 763 * message. 769 764 */ 770 765 int closesocket(int socket_id) 771 766 { 772 socket_ refsocket;767 socket_t *socket; 773 768 int rc; 774 769 … … 811 806 * sockets. 812 807 * @param[in] addrlen The address length. Used only if toaddr is not NULL. 813 * @return sEOK on success.814 * @return sENOTSOCK if the socket is not found.815 * @return sEBADMEM if the data or toaddr parameter is NULL.816 * @return sNO_DATA if the datalength or the addrlen parameter is808 * @return EOK on success. 809 * @return ENOTSOCK if the socket is not found. 810 * @return EBADMEM if the data or toaddr parameter is NULL. 811 * @return NO_DATA if the datalength or the addrlen parameter is 817 812 * zero (0). 818 * @return sOther error codes as defined for the NET_SOCKET_SENDTO813 * @return Other error codes as defined for the NET_SOCKET_SENDTO 819 814 * message. 820 815 */ … … 824 819 socklen_t addrlen) 825 820 { 826 socket_ refsocket;821 socket_t *socket; 827 822 aid_t message_id; 828 823 ipcarg_t result; … … 913 908 * @param[in] datalength The data length. 914 909 * @param[in] flags Various send flags. 915 * @return sEOK on success.916 * @return sENOTSOCK if the socket is not found.917 * @return sEBADMEM if the data parameter is NULL.918 * @return sNO_DATA if the datalength parameter is zero.919 * @return sOther error codes as defined for the NET_SOCKET_SEND910 * @return EOK on success. 911 * @return ENOTSOCK if the socket is not found. 912 * @return EBADMEM if the data parameter is NULL. 913 * @return NO_DATA if the datalength parameter is zero. 914 * @return Other error codes as defined for the NET_SOCKET_SEND 920 915 * message. 921 916 */ … … 937 932 * @param[in] toaddr The destination address. 938 933 * @param[in] addrlen The address length. 939 * @return sEOK on success.940 * @return sENOTSOCK if the socket is not found.941 * @return sEBADMEM if the data or toaddr parameter is NULL.942 * @return sNO_DATA if the datalength or the addrlen parameter is934 * @return EOK on success. 935 * @return ENOTSOCK if the socket is not found. 936 * @return EBADMEM if the data or toaddr parameter is NULL. 937 * @return NO_DATA if the datalength or the addrlen parameter is 943 938 * zero. 944 * @return sOther error codes as defined for the NET_SOCKET_SENDTO939 * @return Other error codes as defined for the NET_SOCKET_SENDTO 945 940 * message. 946 941 */ … … 971 966 * read. The actual address length is set. Used only if 972 967 * fromaddr is not NULL. 973 * @return sEOK on success.974 * @return sENOTSOCK if the socket is not found.975 * @return sEBADMEM if the data parameter is NULL.976 * @return sNO_DATA if the datalength or addrlen parameter is zero.977 * @return sOther error codes as defined for the spcific message.968 * @return EOK on success. 969 * @return ENOTSOCK if the socket is not found. 970 * @return EBADMEM if the data parameter is NULL. 971 * @return NO_DATA if the datalength or addrlen parameter is zero. 972 * @return Other error codes as defined for the spcific message. 978 973 */ 979 974 static int … … 981 976 int flags, struct sockaddr *fromaddr, socklen_t *addrlen) 982 977 { 983 socket_ refsocket;978 socket_t *socket; 984 979 aid_t message_id; 985 980 ipcarg_t ipc_result; … … 1100 1095 * @param[in] datalength The data length. 1101 1096 * @param[in] flags Various receive flags. 1102 * @return sEOK on success.1103 * @return sENOTSOCK if the socket is not found.1104 * @return sEBADMEM if the data parameter is NULL.1105 * @return sNO_DATA if the datalength parameter is zero.1106 * @return sOther error codes as defined for the NET_SOCKET_RECV1097 * @return EOK on success. 1098 * @return ENOTSOCK if the socket is not found. 1099 * @return EBADMEM if the data parameter is NULL. 1100 * @return NO_DATA if the datalength parameter is zero. 1101 * @return Other error codes as defined for the NET_SOCKET_RECV 1107 1102 * message. 1108 1103 */ … … 1123 1118 * @param[in,out] addrlen The address length. The maximum address length is 1124 1119 * read. The actual address length is set. 1125 * @return sEOK on success.1126 * @return sENOTSOCK if the socket is not found.1127 * @return sEBADMEM if the data or fromaddr parameter is NULL.1128 * @return sNO_DATA if the datalength or addrlen parameter is zero.1129 * @return sOther error codes as defined for the NET_SOCKET_RECVFROM1120 * @return EOK on success. 1121 * @return ENOTSOCK if the socket is not found. 1122 * @return EBADMEM if the data or fromaddr parameter is NULL. 1123 * @return NO_DATA if the datalength or addrlen parameter is zero. 1124 * @return Other error codes as defined for the NET_SOCKET_RECVFROM 1130 1125 * message. 1131 1126 */ … … 1153 1148 * @param[in,out] optlen The value buffer length. The maximum length is read. 1154 1149 * The actual length is set. 1155 * @return sEOK on success.1156 * @return sENOTSOCK if the socket is not found.1157 * @return sEBADMEM if the value or optlen parameter is NULL.1158 * @return sNO_DATA if the optlen parameter is zero.1159 * @return sOther error codes as defined for the1150 * @return EOK on success. 1151 * @return ENOTSOCK if the socket is not found. 1152 * @return EBADMEM if the value or optlen parameter is NULL. 1153 * @return NO_DATA if the optlen parameter is zero. 1154 * @return Other error codes as defined for the 1160 1155 * NET_SOCKET_GETSOCKOPT message. 1161 1156 */ … … 1163 1158 getsockopt(int socket_id, int level, int optname, void *value, size_t *optlen) 1164 1159 { 1165 socket_ refsocket;1160 socket_t *socket; 1166 1161 aid_t message_id; 1167 1162 ipcarg_t result; … … 1206 1201 * @param[in] value The value to be set. 1207 1202 * @param[in] optlen The value length. 1208 * @return sEOK on success.1209 * @return sENOTSOCK if the socket is not found.1210 * @return sEBADMEM if the value parameter is NULL.1211 * @return sNO_DATA if the optlen parameter is zero.1212 * @return sOther error codes as defined for the1203 * @return EOK on success. 1204 * @return ENOTSOCK if the socket is not found. 1205 * @return EBADMEM if the value parameter is NULL. 1206 * @return NO_DATA if the optlen parameter is zero. 1207 * @return Other error codes as defined for the 1213 1208 * NET_SOCKET_SETSOCKOPT message. 1214 1209 */ -
uspace/lib/c/include/adt/char_map.h
r1b22bd4 r32eceb4f 48 48 typedef struct char_map char_map_t; 49 49 50 /** Type definition of the character string to integer map pointer.51 * @see char_map52 */53 typedef char_map_t *char_map_ref;54 55 50 /** Character string to integer map item. 56 51 * … … 69 64 int next; 70 65 /** Next character array. */ 71 char_map_ ref*items;66 char_map_t **items; 72 67 /** Consistency check magic value. */ 73 68 int magic; 74 69 }; 75 70 76 extern int char_map_initialize(char_map_ ref);77 extern void char_map_destroy(char_map_ ref);78 extern int char_map_exclude(char_map_ ref, const char *, size_t);79 extern int char_map_add(char_map_ ref, const char *, size_t, const int);80 extern int char_map_find(const char_map_ ref, const char *, size_t);81 extern int char_map_update(char_map_ ref, const char *, size_t, const int);71 extern int char_map_initialize(char_map_t *); 72 extern void char_map_destroy(char_map_t *); 73 extern int char_map_exclude(char_map_t *, const char *, size_t); 74 extern int char_map_add(char_map_t *, const char *, size_t, const int); 75 extern int char_map_find(const char_map_t *, const char *, size_t); 76 extern int char_map_update(char_map_t *, const char *, size_t, const int); 82 77 83 78 #endif -
uspace/lib/c/include/adt/dynamic_fifo.h
r1b22bd4 r32eceb4f 44 44 typedef struct dyn_fifo dyn_fifo_t; 45 45 46 /** Type definition of the dynamic fifo queue pointer.47 * @see dyn_fifo48 */49 typedef dyn_fifo_t *dyn_fifo_ref;50 51 46 /** Dynamic first in first out positive integer queue. 52 47 * Possitive integer values only. … … 66 61 }; 67 62 68 extern int dyn_fifo_initialize(dyn_fifo_ ref, int);69 extern int dyn_fifo_destroy(dyn_fifo_ ref);70 extern int dyn_fifo_push(dyn_fifo_ ref, int, int);71 extern int dyn_fifo_pop(dyn_fifo_ ref);72 extern int dyn_fifo_value(dyn_fifo_ ref);63 extern int dyn_fifo_initialize(dyn_fifo_t *, int); 64 extern int dyn_fifo_destroy(dyn_fifo_t *); 65 extern int dyn_fifo_push(dyn_fifo_t *, int, int); 66 extern int dyn_fifo_pop(dyn_fifo_t *); 67 extern int dyn_fifo_value(dyn_fifo_t *); 73 68 74 69 #endif -
uspace/lib/c/include/adt/generic_char_map.h
r1b22bd4 r32eceb4f 55 55 \ 56 56 typedef struct name name##_t; \ 57 typedef name##_t *name##_ref; \58 57 \ 59 58 struct name { \ … … 63 62 }; \ 64 63 \ 65 int name##_add(name##_ ref, const char *, const size_t, type *); \66 int name##_count(name##_ ref); \67 void name##_destroy(name##_ ref); \68 void name##_exclude(name##_ ref, const char *, const size_t); \69 type *name##_find(name##_ ref, const char *, const size_t); \70 int name##_initialize(name##_ ref); \71 int name##_is_valid(name##_ ref);64 int name##_add(name##_t *, const char *, const size_t, type *); \ 65 int name##_count(name##_t *); \ 66 void name##_destroy(name##_t *); \ 67 void name##_exclude(name##_t *, const char *, const size_t); \ 68 type *name##_find(name##_t *, const char *, const size_t); \ 69 int name##_initialize(name##_t *); \ 70 int name##_is_valid(name##_t *); 72 71 73 72 /** Character string to generic type map implementation. … … 81 80 GENERIC_FIELD_IMPLEMENT(name##_items, type) \ 82 81 \ 83 int name##_add(name##_ refmap, const char *name, const size_t length, \82 int name##_add(name##_t *map, const char *name, const size_t length, \ 84 83 type *value) \ 85 84 { \ … … 99 98 } \ 100 99 \ 101 int name##_count(name##_ refmap) \100 int name##_count(name##_t *map) \ 102 101 { \ 103 102 return name##_is_valid(map) ? \ … … 105 104 } \ 106 105 \ 107 void name##_destroy(name##_ refmap) \106 void name##_destroy(name##_t *map) \ 108 107 { \ 109 108 if (name##_is_valid(map)) { \ … … 113 112 } \ 114 113 \ 115 void name##_exclude(name##_ refmap, const char *name, \114 void name##_exclude(name##_t *map, const char *name, \ 116 115 const size_t length) \ 117 116 { \ … … 125 124 } \ 126 125 \ 127 type *name##_find(name##_ refmap, const char *name, \126 type *name##_find(name##_t *map, const char *name, \ 128 127 const size_t length) \ 129 128 { \ … … 138 137 } \ 139 138 \ 140 int name##_initialize(name##_ refmap) \139 int name##_initialize(name##_t *map) \ 141 140 { \ 142 141 int rc; \ … … 155 154 } \ 156 155 \ 157 int name##_is_valid(name##_ refmap) \156 int name##_is_valid(name##_t *map) \ 158 157 { \ 159 158 return map && (map->magic == GENERIC_CHAR_MAP_MAGIC_VALUE); \ -
uspace/lib/c/include/adt/generic_field.h
r1b22bd4 r32eceb4f 53 53 #define GENERIC_FIELD_DECLARE(name, type) \ 54 54 typedef struct name name##_t; \ 55 typedef name##_t *name##_ref; \56 55 \ 57 56 struct name { \ … … 62 61 }; \ 63 62 \ 64 int name##_add(name##_ ref, type *); \65 int name##_count(name##_ ref); \66 void name##_destroy(name##_ ref); \67 void name##_exclude_index(name##_ ref, int); \68 type **name##_get_field(name##_ ref); \69 type *name##_get_index(name##_ ref, int); \70 int name##_initialize(name##_ ref); \71 int name##_is_valid(name##_ ref);63 int name##_add(name##_t *, type *); \ 64 int name##_count(name##_t *); \ 65 void name##_destroy(name##_t *); \ 66 void name##_exclude_index(name##_t *, int); \ 67 type **name##_get_field(name##_t *); \ 68 type *name##_get_index(name##_t *, int); \ 69 int name##_initialize(name##_t *); \ 70 int name##_is_valid(name##_t *); 72 71 73 72 /** Generic type field implementation. … … 79 78 */ 80 79 #define GENERIC_FIELD_IMPLEMENT(name, type) \ 81 int name##_add(name##_ reffield, type *value) \80 int name##_add(name##_t *field, type *value) \ 82 81 { \ 83 82 if (name##_is_valid(field)) { \ … … 99 98 } \ 100 99 \ 101 int name##_count(name##_ reffield) \100 int name##_count(name##_t *field) \ 102 101 { \ 103 102 return name##_is_valid(field) ? field->next : -1; \ 104 103 } \ 105 104 \ 106 void name##_destroy(name##_ reffield) \105 void name##_destroy(name##_t *field) \ 107 106 { \ 108 107 if (name##_is_valid(field)) { \ … … 117 116 } \ 118 117 \ 119 void name##_exclude_index(name##_ reffield, int index) \118 void name##_exclude_index(name##_t *field, int index) \ 120 119 { \ 121 120 if (name##_is_valid(field) && (index >= 0) && \ … … 126 125 } \ 127 126 \ 128 type *name##_get_index(name##_ reffield, int index) \127 type *name##_get_index(name##_t *field, int index) \ 129 128 { \ 130 129 if (name##_is_valid(field) && (index >= 0) && \ … … 134 133 } \ 135 134 \ 136 type **name##_get_field(name##_ reffield) \135 type **name##_get_field(name##_t *field) \ 137 136 { \ 138 137 return name##_is_valid(field) ? field->items : NULL; \ 139 138 } \ 140 139 \ 141 int name##_initialize(name##_ reffield) \140 int name##_initialize(name##_t *field) \ 142 141 { \ 143 142 if (!field) \ … … 153 152 } \ 154 153 \ 155 int name##_is_valid(name##_ reffield) \154 int name##_is_valid(name##_t *field) \ 156 155 { \ 157 156 return field && (field->magic == GENERIC_FIELD_MAGIC_VALUE); \ -
uspace/lib/c/include/adt/int_map.h
r1b22bd4 r32eceb4f 56 56 #define INT_MAP_DECLARE(name, type) \ 57 57 typedef struct name name##_t; \ 58 typedef name##_t *name##_ref; \59 58 typedef struct name##_item name##_item_t; \ 60 typedef name##_item_t *name##_item_ref; \61 59 \ 62 60 struct name##_item { \ … … 69 67 int size; \ 70 68 int next; \ 71 name##_item_ refitems; \69 name##_item_t *items; \ 72 70 int magic; \ 73 71 }; \ 74 72 \ 75 int name##_add(name##_ ref, int, type *); \76 void name##_clear(name##_ ref); \77 int name##_count(name##_ ref); \78 void name##_destroy(name##_ ref); \79 void name##_exclude(name##_ ref, int); \80 void name##_exclude_index(name##_ ref, int); \81 type *name##_find(name##_ ref, int); \82 int name##_update(name##_ ref, int, int); \83 type *name##_get_index(name##_ ref, int); \84 int name##_initialize(name##_ ref); \85 int name##_is_valid(name##_ ref); \86 void name##_item_destroy(name##_item_ ref); \87 int name##_item_is_valid(name##_item_ ref);73 int name##_add(name##_t *, int, type *); \ 74 void name##_clear(name##_t *); \ 75 int name##_count(name##_t *); \ 76 void name##_destroy(name##_t *); \ 77 void name##_exclude(name##_t *, int); \ 78 void name##_exclude_index(name##_t *, int); \ 79 type *name##_find(name##_t *, int); \ 80 int name##_update(name##_t *, int, int); \ 81 type *name##_get_index(name##_t *, int); \ 82 int name##_initialize(name##_t *); \ 83 int name##_is_valid(name##_t *); \ 84 void name##_item_destroy(name##_item_t *); \ 85 int name##_item_is_valid(name##_item_t *); 88 86 89 87 /** Integer to generic type map implementation. … … 95 93 */ 96 94 #define INT_MAP_IMPLEMENT(name, type) \ 97 int name##_add(name##_ refmap, int key, type *value) \95 int name##_add(name##_t *map, int key, type *value) \ 98 96 { \ 99 97 if (name##_is_valid(map)) { \ 100 98 if (map->next == (map->size - 1)) { \ 101 name##_item_ reftmp; \102 tmp = (name##_item_ ref) realloc(map->items, \99 name##_item_t *tmp; \ 100 tmp = (name##_item_t *) realloc(map->items, \ 103 101 sizeof(name##_item_t) * 2 * map->size); \ 104 102 if (!tmp) \ … … 117 115 } \ 118 116 \ 119 void name##_clear(name##_ refmap) \117 void name##_clear(name##_t *map) \ 120 118 { \ 121 119 if (name##_is_valid(map)) { \ … … 132 130 } \ 133 131 \ 134 int name##_count(name##_ refmap) \132 int name##_count(name##_t *map) \ 135 133 { \ 136 134 return name##_is_valid(map) ? map->next : -1; \ 137 135 } \ 138 136 \ 139 void name##_destroy(name##_ refmap) \137 void name##_destroy(name##_t *map) \ 140 138 { \ 141 139 if (name##_is_valid(map)) { \ … … 152 150 } \ 153 151 \ 154 void name##_exclude(name##_ refmap, int key) \152 void name##_exclude(name##_t *map, int key) \ 155 153 { \ 156 154 if (name##_is_valid(map)) { \ … … 166 164 } \ 167 165 \ 168 void name##_exclude_index(name##_ refmap, int index) \166 void name##_exclude_index(name##_t *map, int index) \ 169 167 { \ 170 168 if (name##_is_valid(map) && (index >= 0) && \ … … 175 173 } \ 176 174 \ 177 type *name##_find(name##_ refmap, int key) \175 type *name##_find(name##_t *map, int key) \ 178 176 { \ 179 177 if (name##_is_valid(map)) { \ … … 189 187 } \ 190 188 \ 191 int name##_update(name##_ refmap, int key, int new_key) \189 int name##_update(name##_t *map, int key, int new_key) \ 192 190 { \ 193 191 if (name##_is_valid(map)) { \ … … 208 206 } \ 209 207 \ 210 type *name##_get_index(name##_ refmap, int index) \208 type *name##_get_index(name##_t *map, int index) \ 211 209 { \ 212 210 if (name##_is_valid(map) && (index >= 0) && \ … … 218 216 } \ 219 217 \ 220 int name##_initialize(name##_ refmap) \218 int name##_initialize(name##_t *map) \ 221 219 { \ 222 220 if (!map) \ … … 224 222 map->size = 2; \ 225 223 map->next = 0; \ 226 map->items = (name##_item_ ref) malloc(sizeof(name##_item_t) * \224 map->items = (name##_item_t *) malloc(sizeof(name##_item_t) * \ 227 225 map->size); \ 228 226 if (!map->items) \ … … 233 231 } \ 234 232 \ 235 int name##_is_valid(name##_ refmap) \233 int name##_is_valid(name##_t *map) \ 236 234 { \ 237 235 return map && (map->magic == INT_MAP_MAGIC_VALUE); \ 238 236 } \ 239 237 \ 240 void name##_item_destroy(name##_item_ refitem) \238 void name##_item_destroy(name##_item_t *item) \ 241 239 { \ 242 240 if (name##_item_is_valid(item)) { \ … … 249 247 } \ 250 248 \ 251 int name##_item_is_valid(name##_item_ refitem) \249 int name##_item_is_valid(name##_item_t *item) \ 252 250 { \ 253 251 return item && (item->magic == INT_MAP_ITEM_MAGIC_VALUE); \ -
uspace/lib/c/include/adt/measured_strings.h
r1b22bd4 r32eceb4f 47 47 typedef struct measured_string measured_string_t; 48 48 49 /** Type definition of the character string with measured length pointer.50 * @see measured_string51 */52 typedef measured_string_t *measured_string_ref;53 54 49 /** Character string with measured length. 55 50 * … … 64 59 }; 65 60 66 extern measured_string_ refmeasured_string_create_bulk(const char *, size_t);67 extern measured_string_ ref measured_string_copy(measured_string_ref);68 extern int measured_strings_receive(measured_string_ ref*, char **, size_t);69 extern int measured_strings_reply(const measured_string_ ref, size_t);70 extern int measured_strings_return(int, measured_string_ ref*, char **, size_t);71 extern int measured_strings_send(int, const measured_string_ ref, size_t);61 extern measured_string_t *measured_string_create_bulk(const char *, size_t); 62 extern measured_string_t *measured_string_copy(measured_string_t *); 63 extern int measured_strings_receive(measured_string_t **, char **, size_t); 64 extern int measured_strings_reply(const measured_string_t *, size_t); 65 extern int measured_strings_return(int, measured_string_t **, char **, size_t); 66 extern int measured_strings_send(int, const measured_string_t *, size_t); 72 67 73 68 #endif -
uspace/lib/c/include/net/device.h
r1b22bd4 r32eceb4f 59 59 */ 60 60 typedef struct device_stats device_stats_t; 61 62 /** Type definition of the device usage statistics pointer.63 * @see device_stats64 */65 typedef device_stats_t *device_stats_ref;66 61 67 62 /** Device state. */ -
uspace/lib/c/include/net/modules.h
r1b22bd4 r32eceb4f 69 69 * 70 70 * @param[in] need The needed module service. 71 * @return sThe phone of the needed service.71 * @return The phone of the needed service. 72 72 */ 73 73 typedef int connect_module_t(services_t need); -
uspace/lib/c/include/net/packet.h
r1b22bd4 r32eceb4f 46 46 * @see packet 47 47 */ 48 typedef struct packet * packet_t; 49 50 /** Type definition of the packet pointer. 51 * @see packet 52 */ 53 typedef packet_t * packet_ref; 48 typedef struct packet packet_t; 54 49 55 50 /** Type definition of the packet dimension. … … 57 52 */ 58 53 typedef struct packet_dimension packet_dimension_t; 59 60 /** Type definition of the packet dimension pointer.61 * @see packet_dimension62 */63 typedef packet_dimension_t * packet_dimension_ref;64 54 65 55 /** Packet dimension. */ … … 79 69 /*@{*/ 80 70 81 extern packet_t pm_find(packet_id_t);82 extern int pm_add(packet_t );71 extern packet_t *pm_find(packet_id_t); 72 extern int pm_add(packet_t *); 83 73 extern int pm_init(void); 84 74 extern void pm_destroy(void); 85 75 86 extern int pq_add(packet_t * , packet_t, size_t, size_t);87 extern packet_t pq_find(packet_t, size_t);88 extern int pq_insert_after(packet_t , packet_t);89 extern packet_t pq_detach(packet_t);90 extern int pq_set_order(packet_t , size_t, size_t);91 extern int pq_get_order(packet_t , size_t *, size_t *);92 extern void pq_destroy(packet_t , void (*)(packet_t));93 extern packet_t pq_next(packet_t);94 extern packet_t pq_previous(packet_t);76 extern int pq_add(packet_t **, packet_t *, size_t, size_t); 77 extern packet_t *pq_find(packet_t *, size_t); 78 extern int pq_insert_after(packet_t *, packet_t *); 79 extern packet_t *pq_detach(packet_t *); 80 extern int pq_set_order(packet_t *, size_t, size_t); 81 extern int pq_get_order(packet_t *, size_t *, size_t *); 82 extern void pq_destroy(packet_t *, void (*)(packet_t *)); 83 extern packet_t *pq_next(packet_t *); 84 extern packet_t *pq_previous(packet_t *); 95 85 96 86 /*@}*/ -
uspace/lib/c/include/net/packet_header.h
r1b22bd4 r32eceb4f 124 124 /** Returns whether the packet is valid. 125 125 * @param[in] packet The packet to be checked. 126 * @return sTrue if the packet is not NULL and the magic value is126 * @return True if the packet is not NULL and the magic value is 127 127 * correct. 128 * @return sFalse otherwise.128 * @return False otherwise. 129 129 */ 130 static inline int packet_is_valid(const packet_t packet)130 static inline int packet_is_valid(const packet_t *packet) 131 131 { 132 132 return packet && (packet->magic_value == PACKET_MAGIC_VALUE); -
uspace/lib/c/include/unistd.h
r1b22bd4 r32eceb4f 41 41 42 42 #ifndef NULL 43 #define NULL 0UL43 #define NULL ((void *) 0) 44 44 #endif 45 45 -
uspace/lib/net/adt/module_map.c
r1b22bd4 r32eceb4f 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
r1b22bd4 r32eceb4f 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
r1b22bd4 r32eceb4f 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
r1b22bd4 r32eceb4f 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
r1b22bd4 r32eceb4f 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.58 */ 59 int packet_copy_data(packet_t packet, const void *data, size_t length)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 */ 59 int packet_copy_data(packet_t *packet, const void *data, size_t length) 60 60 { 61 61 if (!packet_is_valid(packet)) … … 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.82 */ 83 void *packet_prefix(packet_t packet, size_t length)80 * @return The pointer to the allocated memory. 81 * @return NULL if there is not enough memory left. 82 */ 83 void *packet_prefix(packet_t *packet, size_t length) 84 84 { 85 85 if ((!packet_is_valid(packet)) || 86 (packet->data_start - sizeof( struct packet) -86 (packet->data_start - sizeof(packet_t) - 87 87 2 * (packet->dest_addr - packet->src_addr) < length)) { 88 88 return NULL; … … 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.103 */ 104 void *packet_suffix(packet_t packet, size_t length)101 * @return The pointer to the allocated memory. 102 * @return NULL if there is not enough memory left. 103 */ 104 void *packet_suffix(packet_t *packet, size_t length) 105 105 { 106 106 if ((!packet_is_valid(packet)) || … … 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.125 */ 126 int packet_trim(packet_t packet, size_t prefix, size_t suffix)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 */ 126 int packet_trim(packet_t *packet, size_t prefix, size_t suffix) 127 127 { 128 128 if (!packet_is_valid(packet)) … … 140 140 * 141 141 * @param[in] packet The packet. 142 * @return sThe packet identifier.143 * @return sZero if the packet is not valid.144 */ 145 packet_id_t packet_get_id(const packet_t packet)142 * @return The packet identifier. 143 * @return Zero if the packet is not valid. 144 */ 145 packet_id_t packet_get_id(const packet_t *packet) 146 146 { 147 147 return packet_is_valid(packet) ? packet->packet_id : 0; … … 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.158 */ 159 int packet_get_addr(const packet_t packet, uint8_t **src, uint8_t **dest)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 */ 159 int packet_get_addr(const packet_t *packet, uint8_t **src, uint8_t **dest) 160 160 { 161 161 if (!packet_is_valid(packet)) … … 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.178 */ 179 size_t packet_get_data_length(const packet_t packet)176 * @return The packet content length in bytes. 177 * @return Zero if the packet is not valid. 178 */ 179 size_t packet_get_data_length(const packet_t *packet) 180 180 { 181 181 if (!packet_is_valid(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.192 */ 193 void *packet_get_data(const packet_t packet)190 * @return The pointer to the beginning of the packet content. 191 * @return NULL if the packet is not valid. 192 */ 193 void *packet_get_data(const packet_t *packet) 194 194 { 195 195 if (!packet_is_valid(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 212 packet_set_addr(packet_t packet, const uint8_t *src, const uint8_t *dest,212 packet_set_addr(packet_t *packet, const uint8_t *src, const uint8_t *dest, 213 213 size_t addr_len) 214 214 { … … 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.258 */ 259 packet_t packet_get_copy(int phone, packet_tpacket)260 { 261 packet_t copy;256 * @return The packet copy. 257 * @return NULL on error. 258 */ 259 packet_t *packet_get_copy(int phone, packet_t *packet) 260 { 261 packet_t *copy; 262 262 uint8_t * src = NULL; 263 263 uint8_t * dest = NULL; -
uspace/lib/net/generic/packet_remote.c
r1b22bd4 r32eceb4f 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; … … 72 72 message = async_send_1(phone, NET_PACKET_GET, packet_id, &answer); 73 73 74 *packet = (packet_t ) as_get_mappable_page(size);74 *packet = (packet_t *) as_get_mappable_page(size); 75 75 rc = async_share_in_start_0_0(phone, *packet, size); 76 76 if (rc != EOK) { … … 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; … … 127 127 } 128 128 if ((*packet)->next) { 129 packet_t next;129 packet_t *next; 130 130 131 131 return packet_translate_remote(phone, &next, (*packet)->next); … … 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.149 */ 150 packet_t packet_get_4_remote(int phone, size_t max_content, size_t addr_len,147 * @return The packet reference. 148 * @return NULL on error. 149 */ 150 packet_t *packet_get_4_remote(int phone, size_t max_content, size_t addr_len, 151 151 size_t max_prefix, size_t max_suffix) 152 152 { … … 161 161 162 162 163 packet_t packet = pm_find(packet_id);163 packet_t *packet = pm_find(packet_id); 164 164 if (!packet) { 165 165 rc = packet_return(phone, &packet, packet_id, size); … … 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.181 */ 182 packet_t packet_get_1_remote(int phone, size_t content)179 * @return The packet reference. 180 * @return NULL on error. 181 */ 182 packet_t *packet_get_1_remote(int phone, size_t content) 183 183 { 184 184 ipcarg_t packet_id; … … 191 191 return NULL; 192 192 193 packet_t packet = pm_find(packet_id);193 packet_t *packet = pm_find(packet_id); 194 194 if (!packet) { 195 195 rc = packet_return(phone, &packet, packet_id, size); -
uspace/lib/net/generic/protocol_map.c
r1b22bd4 r32eceb4f 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
r1b22bd4 r32eceb4f 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/il_interface.c
r1b22bd4 r32eceb4f 77 77 * 78 78 */ 79 int il_received_msg(int il_phone, device_id_t device_id, packet_t packet,79 int il_received_msg(int il_phone, device_id_t device_id, packet_t *packet, 80 80 services_t target) 81 81 { -
uspace/lib/net/il/ip_client.c
r1b22bd4 r32eceb4f 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.52 */ 53 size_t ip_client_header_length(packet_t packet)54 { 55 ip_header_ refheader;56 57 header = (ip_header_ ref) packet_get_data(packet);50 * @return The IP header length in bytes. 51 * @return Zero if there is no IP header. 52 */ 53 size_t ip_client_header_length(packet_t *packet) 54 { 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.152 */ 153 int 154 ip_client_prepare_packet(packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl,150 * @return EOK on success. 151 * @return ENOMEM if there is not enough memory left in the packet. 152 */ 153 int 154 ip_client_prepare_packet(packet_t *packet, ip_protocol_t protocol, ip_ttl_t ttl, 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 */ 209 209 int 210 ip_client_process_packet(packet_t packet, ip_protocol_t *protocol,210 ip_client_process_packet(packet_t *packet, ip_protocol_t *protocol, 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
r1b22bd4 r32eceb4f 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, … … 204 204 */ 205 205 int ip_received_error_msg_remote(int ip_phone, device_id_t device_id, 206 packet_t packet, services_t target, services_t error)206 packet_t *packet, services_t target, services_t error) 207 207 { 208 208 return generic_received_msg_remote(ip_phone, NET_IP_RECEIVED_ERROR, … … 225 225 * function. 226 226 */ 227 int ip_send_msg_remote(int ip_phone, device_id_t device_id, packet_t packet,227 int ip_send_msg_remote(int ip_phone, device_id_t device_id, packet_t *packet, 228 228 services_t sender, services_t error) 229 229 { -
uspace/lib/net/include/adt/module_map.h
r1b22bd4 r32eceb4f 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
r1b22bd4 r32eceb4f 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
r1b22bd4 r32eceb4f 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_client.h
r1b22bd4 r32eceb4f 41 41 #include <net/packet.h> 42 42 43 extern int icmp_client_process_packet(packet_t , icmp_type_t *, icmp_code_t *,43 extern int icmp_client_process_packet(packet_t *, icmp_type_t *, icmp_code_t *, 44 44 icmp_param_t *, icmp_param_t *); 45 extern size_t icmp_client_header_length(packet_t );45 extern size_t icmp_client_header_length(packet_t *); 46 46 47 47 #endif -
uspace/lib/net/include/icmp_header.h
r1b22bd4 r32eceb4f 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/icmp_interface.h
r1b22bd4 r32eceb4f 51 51 52 52 extern int icmp_destination_unreachable_msg(int, icmp_code_t, icmp_param_t, 53 packet_t );54 extern int icmp_source_quench_msg(int, packet_t );55 extern int icmp_time_exceeded_msg(int, icmp_code_t, packet_t );56 extern int icmp_parameter_problem_msg(int, icmp_code_t, icmp_param_t, packet_t );53 packet_t *); 54 extern int icmp_source_quench_msg(int, packet_t *); 55 extern int icmp_time_exceeded_msg(int, icmp_code_t, packet_t *); 56 extern int icmp_parameter_problem_msg(int, icmp_code_t, icmp_param_t, packet_t *); 57 57 58 58 /*@}*/ -
uspace/lib/net/include/il_interface.h
r1b22bd4 r32eceb4f 51 51 52 52 extern int il_device_state_msg(int, device_id_t, device_state_t, services_t); 53 extern int il_received_msg(int, device_id_t, packet_t , services_t);53 extern int il_received_msg(int, device_id_t, packet_t *, services_t); 54 54 extern int il_mtu_changed_msg(int, device_id_t, size_t, services_t); 55 55 -
uspace/lib/net/include/il_local.h
r1b22bd4 r32eceb4f 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_client.h
r1b22bd4 r32eceb4f 45 45 #include <ip_interface.h> 46 46 47 extern int ip_client_prepare_packet(packet_t , ip_protocol_t, ip_ttl_t, ip_tos_t,48 i nt, size_t);49 extern int ip_client_process_packet(packet_t , ip_protocol_t *, ip_ttl_t *,47 extern int ip_client_prepare_packet(packet_t *, ip_protocol_t, ip_ttl_t, 48 ip_tos_t, int, size_t); 49 extern int ip_client_process_packet(packet_t *, ip_protocol_t *, ip_ttl_t *, 50 50 ip_tos_t *, int *, size_t *); 51 extern size_t ip_client_header_length(packet_t );51 extern size_t ip_client_header_length(packet_t *); 52 52 extern int ip_client_set_pseudo_header_data_length(void *, size_t, size_t); 53 53 extern int ip_client_get_pseudo_header(ip_protocol_t, struct sockaddr *, -
uspace/lib/net/include/ip_header.h
r1b22bd4 r32eceb4f 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
r1b22bd4 r32eceb4f 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 typedef int (*tl_received_msg_t)(device_id_t device_id, packet_t packet,72 typedef int (*tl_received_msg_t)(device_id_t device_id, packet_t *packet, 73 73 services_t receiver, services_t error); 74 74 -
uspace/lib/net/include/ip_remote.h
r1b22bd4 r32eceb4f 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);47 extern int ip_received_error_msg_remote(int, device_id_t, packet_t , services_t,46 extern int ip_packet_size_req_remote(int, device_id_t, packet_dimension_t *); 47 extern int ip_received_error_msg_remote(int, device_id_t, packet_t *, services_t, 48 48 services_t); 49 49 extern int ip_device_req_remote(int, device_id_t, services_t); 50 50 extern int ip_add_route_req_remote(int, device_id_t, in_addr_t, in_addr_t, 51 51 in_addr_t); 52 extern int ip_send_msg_remote(int, device_id_t, packet_t , services_t,52 extern int ip_send_msg_remote(int, device_id_t, packet_t *, services_t, 53 53 services_t); 54 54 extern int ip_get_route_req_remote(int, ip_protocol_t, const struct sockaddr *, -
uspace/lib/net/include/net_interface.h
r1b22bd4 r32eceb4f 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
r1b22bd4 r32eceb4f 111 111 * message implementation. 112 112 */ 113 extern int netif_send_message(device_id_t device_id, packet_t packet,113 extern int netif_send_message(device_id_t device_id, packet_t *packet, 114 114 services_t sender); 115 115 … … 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); 200 extern int netif_send_msg_local(int, device_id_t, packet_t , services_t);200 extern int netif_send_msg_local(int, device_id_t, packet_t *, services_t); 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 extern packet_t netif_packet_get_1(size_t);210 extern packet_t *netif_packet_get_1(size_t); 211 211 extern int netif_init_module(async_client_conn_t); 212 212 -
uspace/lib/net/include/netif_remote.h
r1b22bd4 r32eceb4f 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); 46 extern int netif_send_msg_remote(int, device_id_t, packet_t , services_t);46 extern int netif_send_msg_remote(int, device_id_t, packet_t *, services_t); 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/nil_local.h
r1b22bd4 r32eceb4f 77 77 * received function. 78 78 */ 79 extern int nil_received_msg_local(int, device_id_t, packet_t , services_t);79 extern int nil_received_msg_local(int, device_id_t, packet_t *, services_t); 80 80 81 81 /** Message processing function. -
uspace/lib/net/include/nil_remote.h
r1b22bd4 r32eceb4f 39 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 extern int nil_received_msg_remote(int, device_id_t, packet_t *, services_t); 42 42 43 43 #endif -
uspace/lib/net/include/packet_client.h
r1b22bd4 r32eceb4f 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) \ 99 99 packet_trim((packet), sizeof(prefix), sizeof(suffix)) 100 100 101 extern void *packet_prefix(packet_t , size_t);102 extern void *packet_suffix(packet_t , size_t);103 extern int packet_trim(packet_t , size_t, size_t);104 extern int packet_copy_data(packet_t , const void *, size_t);105 extern packet_id_t packet_get_id(const packet_t );106 extern size_t packet_get_data_length(const packet_t );107 extern void *packet_get_data(const packet_t );108 extern int packet_get_addr(const packet_t , uint8_t **, uint8_t **);109 extern int packet_set_addr(packet_t , const uint8_t *, const uint8_t *, size_t);110 extern packet_t packet_get_copy(int phone, packet_t packet);101 extern void *packet_prefix(packet_t *, size_t); 102 extern void *packet_suffix(packet_t *, size_t); 103 extern int packet_trim(packet_t *, size_t, size_t); 104 extern int packet_copy_data(packet_t *, const void *, size_t); 105 extern packet_id_t packet_get_id(const packet_t *); 106 extern size_t packet_get_data_length(const packet_t *); 107 extern void *packet_get_data(const packet_t *); 108 extern int packet_get_addr(const packet_t *, uint8_t **, uint8_t **); 109 extern int packet_set_addr(packet_t *, const uint8_t *, const uint8_t *, size_t); 110 extern packet_t *packet_get_copy(int, packet_t *); 111 111 112 112 /*@}*/ -
uspace/lib/net/include/packet_remote.h
r1b22bd4 r32eceb4f 37 37 #include <sys/types.h> 38 38 39 extern int packet_translate_remote(int, packet_ ref, packet_id_t);40 extern packet_t packet_get_4_remote(int, size_t, size_t, size_t, size_t);41 extern packet_t packet_get_1_remote(int, size_t);39 extern int packet_translate_remote(int, packet_t **, packet_id_t); 40 extern packet_t *packet_get_4_remote(int, size_t, size_t, size_t, size_t); 41 extern packet_t *packet_get_1_remote(int, size_t); 42 42 extern void pq_release_remote(int, packet_id_t); 43 43 -
uspace/lib/net/include/socket_core.h
r1b22bd4 r32eceb4f 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));129 extern int socket_reply_packets(packet_t , size_t *);130 extern socket_core_ ref socket_port_find(socket_ports_ref, int, const char *,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 *)); 119 extern int socket_reply_packets(packet_t *, size_t *); 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
r1b22bd4 r32eceb4f 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 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);59 extern int tl_prepare_icmp_packet(int, int, packet_t *, services_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_interface.h
r1b22bd4 r32eceb4f 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, services_t); 55 55 56 56 /*@}*/ -
uspace/lib/net/include/tl_local.h
r1b22bd4 r32eceb4f 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
r1b22bd4 r32eceb4f 92 92 */ 93 93 int netif_send_msg_local(int netif_phone, device_id_t device_id, 94 packet_t packet, services_t sender)94 packet_t *packet, services_t sender) 95 95 { 96 96 fibril_rwlock_write_lock(&netif_globals.lock); … … 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)); … … 307 307 * 308 308 */ 309 packet_t netif_packet_get_1(size_t content)309 packet_t *netif_packet_get_1(size_t content) 310 310 { 311 311 return packet_get_1_remote(netif_globals.net_phone, content); … … 361 361 size_t length; 362 362 device_stats_t stats; 363 packet_t packet;363 packet_t *packet; 364 364 measured_string_t address; 365 365 int rc; -
uspace/lib/net/netif/netif_remote.c
r1b22bd4 r32eceb4f 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, … … 93 93 */ 94 94 int 95 netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t packet,95 netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t *packet, 96 96 services_t sender) 97 97 { … … 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/nil/nil_remote.c
r1b22bd4 r32eceb4f 74 74 */ 75 75 int nil_received_msg_remote(int nil_phone, device_id_t device_id, 76 packet_t packet, services_t target)76 packet_t *packet, services_t target) 77 77 { 78 78 return generic_received_msg_remote(nil_phone, NET_NIL_RECEIVED, -
uspace/lib/net/tl/icmp_client.c
r1b22bd4 r32eceb4f 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 63 icmp_client_process_packet(packet_t packet, icmp_type_t *type,63 icmp_client_process_packet(packet_t *packet, icmp_type_t *type, 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 size_t icmp_client_header_length(packet_t packet)96 size_t icmp_client_header_length(packet_t *packet) 97 97 { 98 98 if (packet_get_data_length(packet) < sizeof(icmp_header_t)) -
uspace/lib/net/tl/icmp_remote.c
r1b22bd4 r32eceb4f 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 64 64 icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code, 65 icmp_param_t mtu, packet_t packet)65 icmp_param_t mtu, packet_t *packet) 66 66 { 67 67 async_msg_3(icmp_phone, NET_ICMP_DEST_UNREACH, (ipcarg_t) code, … … 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 int icmp_source_quench_msg(int icmp_phone, packet_t packet)84 int icmp_source_quench_msg(int icmp_phone, packet_t *packet) 85 85 { 86 86 async_msg_2(icmp_phone, NET_ICMP_SOURCE_QUENCH, 0, … … 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 int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t packet)104 int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t *packet) 105 105 { 106 106 async_msg_2(icmp_phone, NET_ICMP_TIME_EXCEEDED, (ipcarg_t) code, … … 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, 126 icmp_param_t pointer, packet_t packet)126 icmp_param_t pointer, packet_t *packet) 127 127 { 128 128 async_msg_3(icmp_phone, NET_ICMP_PARAMETERPROB, (ipcarg_t) code, -
uspace/lib/net/tl/socket_core.c
r1b22bd4 r32eceb4f 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 */ 524 int socket_reply_packets(packet_t packet, size_t *length)525 { 526 packet_t next_packet;524 int socket_reply_packets(packet_t *packet, size_t *length) 525 { 526 packet_t *next_packet; 527 527 size_t fragments; 528 528 size_t *lengths; … … 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
r1b22bd4 r32eceb4f 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.248 */ 249 int 250 tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t packet,246 * @return EOK on success. 247 * @return ENOENT if no packet may be sent. 248 */ 249 int 250 tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t *packet, 251 251 services_t error) 252 252 { 253 packet_t next;253 packet_t *next; 254 254 uint8_t *src; 255 255 int length; … … 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 { -
uspace/lib/net/tl/tl_interface.c
r1b22bd4 r32eceb4f 58 58 */ 59 59 int 60 tl_received_msg(int tl_phone, device_id_t device_id, packet_t packet,60 tl_received_msg(int tl_phone, device_id_t device_id, packet_t *packet, 61 61 services_t target, services_t error) 62 62 { -
uspace/lib/packet/generic/packet_server.c
r1b22bd4 r32eceb4f 36 36 37 37 #include <packet_server.h> 38 #include <packet_local.h>39 38 40 39 #include <align.h> … … 69 68 fibril_mutex_t lock; 70 69 /** Free packet queues. */ 71 packet_t free[FREE_QUEUES_COUNT];70 packet_t *free[FREE_QUEUES_COUNT]; 72 71 73 72 /** … … 103 102 }; 104 103 105 int packet_translate_local(int phone, packet_ref packet, packet_id_t packet_id)106 {107 if (!packet)108 return EINVAL;109 110 *packet = pm_find(packet_id);111 return (*packet) ? EOK : ENOENT;112 }113 114 104 /** Clears and initializes the packet according to the given dimensions. 115 105 * … … 122 112 */ 123 113 static void 124 packet_init(packet_t packet, size_t addr_len, size_t max_prefix,114 packet_init(packet_t *packet, size_t addr_len, size_t max_prefix, 125 115 size_t max_content, size_t max_suffix) 126 116 { 127 117 // clear the packet content 128 bzero(((void *) packet) + sizeof( struct packet),129 packet->length - sizeof( struct packet));118 bzero(((void *) packet) + sizeof(packet_t), 119 packet->length - sizeof(packet_t)); 130 120 131 121 // clear the packet header … … 135 125 packet->next = 0; 136 126 packet->addr_len = 0; 137 packet->src_addr = sizeof( struct packet);127 packet->src_addr = sizeof(packet_t); 138 128 packet->dest_addr = packet->src_addr + addr_len; 139 129 packet->max_prefix = max_prefix; … … 154 144 * @param[in] max_content The maximal content length in bytes. 155 145 * @param[in] max_suffix The maximal suffix length in bytes. 156 * @return sThe packet of dimensions at least as given.157 * @return sNULL if there is not enough memory left.158 */ 159 static packet_t 146 * @return The packet of dimensions at least as given. 147 * @return NULL if there is not enough memory left. 148 */ 149 static packet_t * 160 150 packet_create(size_t length, size_t addr_len, size_t max_prefix, 161 151 size_t max_content, size_t max_suffix) 162 152 { 163 packet_t packet;153 packet_t *packet; 164 154 int rc; 165 155 166 156 // already locked 167 packet = (packet_t ) mmap(NULL, length, PROTO_READ | PROTO_WRITE,157 packet = (packet_t *) mmap(NULL, length, PROTO_READ | PROTO_WRITE, 168 158 MAP_SHARED | MAP_ANONYMOUS, 0, 0); 169 159 if (packet == MAP_FAILED) … … 198 188 * @return NULL if there is not enough memory left. 199 189 */ 200 static packet_t 190 static packet_t * 201 191 packet_get_local(size_t addr_len, size_t max_prefix, size_t max_content, 202 192 size_t max_suffix) 203 193 { 204 size_t length = ALIGN_UP(sizeof( struct packet) + 2 * addr_len +194 size_t length = ALIGN_UP(sizeof(packet_t) + 2 * addr_len + 205 195 max_prefix + max_content + max_suffix, PAGE_SIZE); 206 196 207 197 fibril_mutex_lock(&ps_globals.lock); 208 198 209 packet_t packet;199 packet_t *packet; 210 200 unsigned int index; 211 201 … … 241 231 } 242 232 243 packet_t packet_get_4_local(int phone, size_t max_content, size_t addr_len,244 size_t max_prefix, size_t max_suffix)245 {246 return packet_get_local(addr_len, max_prefix, max_content, max_suffix);247 }248 249 packet_t packet_get_1_local(int phone, size_t content)250 {251 return packet_get_local(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, content,252 DEFAULT_SUFFIX);253 }254 255 233 /** Release the packet and returns it to the appropriate free packet queue. 256 234 * … … 260 238 * 261 239 */ 262 static void packet_release(packet_t packet)240 static void packet_release(packet_t *packet) 263 241 { 264 242 int index; … … 278 256 * 279 257 * @param[in] packet_id The first packet identifier. 280 * @return sEOK on success.281 * @return sENOENT if there is no such packet.258 * @return EOK on success. 259 * @return ENOENT if there is no such packet. 282 260 */ 283 261 static int packet_release_wrapper(packet_id_t packet_id) 284 262 { 285 packet_t packet;263 packet_t *packet; 286 264 287 265 packet = pm_find(packet_id); … … 296 274 } 297 275 298 void pq_release_local(int phone, packet_id_t packet_id)299 {300 (void) packet_release_wrapper(packet_id);301 }302 303 276 /** Shares the packet memory block. 304 277 * @param[in] packet The packet to be shared. 305 * @return sEOK on success.306 * @return sEINVAL if the packet is not valid.307 * @return sEINVAL if the calling module does not accept the memory.308 * @return sENOMEM if the desired and actual sizes differ.309 * @return sOther error codes as defined for the278 * @return EOK on success. 279 * @return EINVAL if the packet is not valid. 280 * @return EINVAL if the calling module does not accept the memory. 281 * @return ENOMEM if the desired and actual sizes differ. 282 * @return Other error codes as defined for the 310 283 * async_share_in_finalize() function. 311 284 */ 312 static int packet_reply( const packet_tpacket)285 static int packet_reply(packet_t *packet) 313 286 { 314 287 ipc_callid_t callid; … … 339 312 * @param[out] answer_count The last parameter for the actual answer in the 340 313 * answer parameter. 341 * @return sEOK on success.342 * @return sENOMEM if there is not enough memory left.343 * @return sENOENT if there is no such packet as in the packet314 * @return EOK on success. 315 * @return ENOMEM if there is not enough memory left. 316 * @return ENOENT if there is no such packet as in the packet 344 317 * message parameter. 345 * @return sENOTSUP if the message is not known.346 * @return sOther error codes as defined for the318 * @return ENOTSUP if the message is not known. 319 * @return Other error codes as defined for the 347 320 * packet_release_wrapper() function. 348 321 */ … … 351 324 int *answer_count) 352 325 { 353 packet_t packet;326 packet_t *packet; 354 327 355 328 *answer_count = 0; -
uspace/lib/usb/src/hcdhubd.c
r1b22bd4 r32eceb4f 305 305 hc->transfer_ops->transfer_out(hc, &dev, &endpoint, buffer, size, NULL, NULL); 306 306 307 *handle = NULL;307 *handle = (usb_handle_t)NULL; 308 308 309 309 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.
