Changeset 0b749a3 in mainline for uspace/lib/c/include
- Timestamp:
- 2010-11-22T15:39:53Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0eddb76, aae339e9
- Parents:
- 9a1d8ab (diff), 8cd1aa5e (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/c/include
- Files:
-
- 22 added
- 15 edited
- 18 moved
-
adt/char_map.h (added)
-
adt/dynamic_fifo.h (moved) (moved from uspace/lib/net/include/ip_local.h ) (1 diff)
-
adt/generic_char_map.h (added)
-
adt/generic_field.h (added)
-
adt/int_map.h (added)
-
adt/measured_strings.h (added)
-
async_rel.h (added)
-
byteorder.h (modified) (1 diff)
-
ddi.h (modified) (1 diff)
-
device/char.h (added)
-
device/hw_res.h (added)
-
devman.h (added)
-
devmap.h (modified) (2 diffs)
-
err.h (modified) (2 diffs)
-
errno.h (modified) (1 diff)
-
fibril.h (modified) (2 diffs)
-
fibril_synch.h (modified) (5 diffs)
-
ipc/arp.h (moved) (moved from uspace/lib/net/include/arp_messages.h ) (1 diff)
-
ipc/dev_iface.h (added)
-
ipc/devman.h (added)
-
ipc/devmap.h (modified) (2 diffs)
-
ipc/driver.h (added)
-
ipc/icmp.h (moved) (moved from uspace/lib/socket/include/icmp_messages.h ) (1 diff)
-
ipc/il.h (moved) (moved from uspace/lib/net/include/il_messages.h ) (2 diffs)
-
ipc/ip.h (moved) (moved from uspace/lib/net/include/ip_messages.h ) (1 diff)
-
ipc/net.h (added)
-
ipc/net_net.h (moved) (moved from uspace/lib/net/include/net_net_messages.h ) (1 diff)
-
ipc/netif.h (moved) (moved from uspace/lib/net/include/netif_messages.h ) (4 diffs)
-
ipc/nil.h (moved) (moved from uspace/lib/net/include/nil_messages.h ) (2 diffs)
-
ipc/packet.h (moved) (moved from uspace/lib/socket/include/packet/packet_messages.h ) (2 diffs)
-
ipc/serial_ctl.h (added)
-
ipc/services.h (modified) (2 diffs)
-
ipc/socket.h (moved) (moved from uspace/lib/socket/include/socket_messages.h ) (2 diffs)
-
ipc/tl.h (moved) (moved from uspace/lib/net/include/tl_messages.h ) (1 diff)
-
net/device.h (moved) (moved from uspace/lib/socket/include/net_device.h ) (2 diffs)
-
net/icmp_api.h (added)
-
net/icmp_codes.h (moved) (moved from uspace/lib/socket/include/icmp_codes.h ) (2 diffs)
-
net/icmp_common.h (added)
-
net/in.h (moved) (moved from uspace/lib/socket/include/in.h ) (2 diffs)
-
net/in6.h (moved) (moved from uspace/lib/socket/include/in6.h ) (2 diffs)
-
net/inet.h (moved) (moved from uspace/lib/socket/include/icmp_common.h ) (1 diff)
-
net/ip_codes.h (added)
-
net/ip_protocols.h (added)
-
net/modules.h (added)
-
net/packet.h (added)
-
net/packet_header.h (moved) (moved from uspace/lib/socket/include/packet/packet_header.h ) (1 diff)
-
net/socket.h (added)
-
net/socket_codes.h (added)
-
net/socket_parse.h (moved) (moved from uspace/lib/socket/include/socket_parse.h )
-
stdio.h (modified) (1 diff)
-
sys/stat.h (modified) (2 diffs)
-
sys/time.h (modified) (1 diff)
-
task.h (modified) (1 diff)
-
unistd.h (modified) (2 diffs)
-
vfs/vfs.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/adt/dynamic_fifo.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup ip30 * @{29 /** @addtogroup libc 30 * @{ 31 31 */ 32 32 33 #ifndef __NET_IP_LOCAL_H__ 34 #define __NET_IP_LOCAL_H__ 33 /** @file 34 * Dynamic first in first out positive integer queue. 35 * Possitive integer values only. 36 */ 35 37 36 #i nclude <async.h>37 # include <ipc/services.h>38 #ifndef LIBC_DYNAMIC_FIFO_H_ 39 #define LIBC_DYNAMIC_FIFO_H_ 38 40 39 #include <ip_codes.h> 40 #include <inet.h> 41 #include <in.h> 42 #include <socket.h> 41 /** Type definition of the dynamic fifo queue. 42 * @see dyn_fifo 43 */ 44 typedef struct dyn_fifo dyn_fifo_t; 43 45 44 extern int ip_received_error_msg_local(int, device_id_t, packet_t, services_t, 45 services_t); 46 extern int ip_set_gateway_req_local(int, device_id_t, in_addr_t); 47 extern int ip_packet_size_req_local(int, device_id_t, packet_dimension_ref); 48 extern int ip_received_error_msg_local(int, device_id_t, packet_t, services_t, 49 services_t); 50 extern int ip_device_req_local(int, device_id_t, services_t); 51 extern int ip_add_route_req_local(int, device_id_t, in_addr_t, in_addr_t, 52 in_addr_t); 53 extern int ip_send_msg_local(int, device_id_t, packet_t, services_t, 54 services_t); 55 extern int ip_get_route_req_local(int, ip_protocol_t, const struct sockaddr *, 56 socklen_t, device_id_t *, void **, size_t *); 46 /** Dynamic first in first out positive integer queue. 47 * Possitive integer values only. 48 * The queue automatically resizes if needed. 49 */ 50 struct dyn_fifo { 51 /** Stored item field. */ 52 int *items; 53 /** Actual field size. */ 54 int size; 55 /** First item in the queue index. */ 56 int head; 57 /** Last item in the queue index. */ 58 int tail; 59 /** Consistency check magic value. */ 60 int magic_value; 61 }; 62 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 *); 57 68 58 69 #endif -
uspace/lib/c/include/byteorder.h
r9a1d8ab r0b749a3 80 80 #endif 81 81 82 #define htons(n) host2uint16_t_be((n)) 83 #define htonl(n) host2uint32_t_be((n)) 84 #define ntohs(n) uint16_t_be2host((n)) 85 #define ntohl(n) uint32_t_be2host((n)) 86 82 87 static inline uint64_t uint64_t_byteorder_swap(uint64_t n) 83 88 { -
uspace/lib/c/include/ddi.h
r9a1d8ab r0b749a3 41 41 extern int physmem_map(void *, void *, unsigned long, int); 42 42 extern int iospace_enable(task_id_t, void *, unsigned long); 43 extern int preemption_control(int);44 43 extern int pio_enable(void *, size_t, void **); 44 extern int interrupt_enable(int); 45 extern int interrupt_disable(int); 45 46 46 47 #endif -
uspace/lib/c/include/devmap.h
r9a1d8ab r0b749a3 44 44 45 45 extern int devmap_driver_register(const char *, async_client_conn_t); 46 extern int devmap_device_register(const char *, dev _handle_t *);46 extern int devmap_device_register(const char *, devmap_handle_t *); 47 47 48 extern int devmap_device_get_handle(const char *, dev _handle_t *, unsigned int);49 extern int devmap_namespace_get_handle(const char *, dev _handle_t *, unsigned int);50 extern devmap_handle_type_t devmap_handle_probe(dev _handle_t);48 extern int devmap_device_get_handle(const char *, devmap_handle_t *, unsigned int); 49 extern int devmap_namespace_get_handle(const char *, devmap_handle_t *, unsigned int); 50 extern devmap_handle_type_t devmap_handle_probe(devmap_handle_t); 51 51 52 extern int devmap_device_connect(dev _handle_t, unsigned int);52 extern int devmap_device_connect(devmap_handle_t, unsigned int); 53 53 54 54 extern int devmap_null_create(void); … … 56 56 57 57 extern size_t devmap_count_namespaces(void); 58 extern size_t devmap_count_devices(dev _handle_t);58 extern size_t devmap_count_devices(devmap_handle_t); 59 59 60 60 extern size_t devmap_get_namespaces(dev_desc_t **); 61 extern size_t devmap_get_devices(dev _handle_t, dev_desc_t **);61 extern size_t devmap_get_devices(devmap_handle_t, dev_desc_t **); 62 62 63 63 #endif -
uspace/lib/c/include/err.h
r9a1d8ab r0b749a3 36 36 #define LIBC_ERR_H_ 37 37 38 #include <stdio.h> 39 38 40 #define errx(status, fmt, ...) { \ 39 41 printf((fmt), ##__VA_ARGS__); \ … … 45 47 /** @} 46 48 */ 49 -
uspace/lib/c/include/errno.h
r9a1d8ab r0b749a3 56 56 #define EMLINK (-266) 57 57 58 /** An API function is called while another blocking function is in progress. */ 59 #define EINPROGRESS (-10036) 60 61 /** The socket identifier is not valid. */ 62 #define ENOTSOCK (-10038) 63 64 /** The destination address required. */ 65 #define EDESTADDRREQ (-10039) 66 67 /** Protocol is not supported. */ 68 #define EPROTONOSUPPORT (-10043) 69 70 /** Socket type is not supported. */ 71 #define ESOCKTNOSUPPORT (-10044) 72 73 /** Protocol family is not supported. */ 74 #define EPFNOSUPPORT (-10046) 75 76 /** Address family is not supported. */ 77 #define EAFNOSUPPORT (-10047) 78 79 /** Address is already in use. */ 80 #define EADDRINUSE (-10048) 81 82 /** The socket is not connected or bound. */ 83 #define ENOTCONN (-10057) 84 85 /** The requested operation was not performed. 86 * Try again later. 87 */ 88 #define TRY_AGAIN (-11002) 89 90 /** No data. 91 */ 92 #define NO_DATA (-11004) 93 58 94 #endif 59 95 -
uspace/lib/c/include/fibril.h
r9a1d8ab r0b749a3 48 48 #define FIBRIL_WRITER 2 49 49 50 struct fibril; 51 52 typedef struct { 53 struct fibril *owned_by; 54 } fibril_owner_info_t; 55 50 56 typedef enum { 51 57 FIBRIL_PREEMPT, … … 68 74 int retval; 69 75 int flags; 76 77 fibril_owner_info_t *waits_for; 70 78 } fibril_t; 71 79 -
uspace/lib/c/include/fibril_synch.h
r9a1d8ab r0b749a3 43 43 44 44 typedef struct { 45 fibril_owner_info_t oi; /* Keep this the first thing. */ 45 46 int counter; 46 47 link_t waiters; 47 48 } fibril_mutex_t; 48 49 49 #define FIBRIL_MUTEX_INITIALIZE(name) \ 50 fibril_mutex_t name = { \ 50 #define FIBRIL_MUTEX_INITIALIZER(name) \ 51 { \ 52 .oi = { \ 53 .owned_by = NULL \ 54 }, \ 51 55 .counter = 1, \ 52 56 .waiters = { \ … … 55 59 } \ 56 60 } 61 62 #define FIBRIL_MUTEX_INITIALIZE(name) \ 63 fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name) 57 64 58 65 typedef struct { 66 fibril_owner_info_t oi; /* Keep this the first thing. */ 59 67 unsigned writers; 60 68 unsigned readers; … … 62 70 } fibril_rwlock_t; 63 71 64 #define FIBRIL_RWLOCK_INITIALIZE(name) \ 65 fibril_rwlock_t name = { \ 72 #define FIBRIL_RWLOCK_INITIALIZER(name) \ 73 { \ 74 .oi = { \ 75 .owned_by = NULL \ 76 }, \ 66 77 .readers = 0, \ 67 78 .writers = 0, \ … … 72 83 } 73 84 85 #define FIBRIL_RWLOCK_INITIALIZE(name) \ 86 fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name) 87 74 88 typedef struct { 75 89 link_t waiters; 76 90 } fibril_condvar_t; 77 91 78 #define FIBRIL_CONDVAR_INITIALIZE (name) \79 fibril_condvar_t name ={ \92 #define FIBRIL_CONDVAR_INITIALIZER(name) \ 93 { \ 80 94 .waiters = { \ 81 95 .next = &name.waiters, \ … … 83 97 } \ 84 98 } 99 100 #define FIBRIL_CONDVAR_INITIALIZE(name) \ 101 fibril_condvar_t name = FIBRIL_CONDVAR_INITIALIZER(name) 85 102 86 103 extern void fibril_mutex_initialize(fibril_mutex_t *); -
uspace/lib/c/include/ipc/arp.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup arp30 * @{29 /** @addtogroup libc 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * ARP module messages.35 * @see arp_interface.h34 * ARP module messages. 35 * @see arp_interface.h 36 36 */ 37 37 38 #ifndef __NET_ARP_MESSAGES__39 #define __NET_ARP_MESSAGES__38 #ifndef LIBC_ARP_MESSAGES_ 39 #define LIBC_ARP_MESSAGES_ 40 40 41 41 #include <ipc/ipc.h> 42 #include <ipc/net.h> 42 43 43 #include <net_messages.h> 44 45 /** ARP module messages. 46 */ 47 typedef enum{ 44 /** ARP module messages. */ 45 typedef enum { 48 46 /** Clean cache message. 49 * @see arp_clean_cache()47 * @see arp_clean_cache() 50 48 */ 51 49 NET_ARP_CLEAN_CACHE = NET_ARP_FIRST, 52 50 /** Clear address cache message. 53 * @see arp_clear_address_msg()51 * @see arp_clear_address_msg() 54 52 */ 55 53 NET_ARP_CLEAR_ADDRESS, 56 54 /** Clear device cache message. 57 * @see arp_clear_device_req()55 * @see arp_clear_device_req() 58 56 */ 59 57 NET_ARP_CLEAR_DEVICE, 60 58 /** New device message. 61 * @see arp_device_req()59 * @see arp_device_req() 62 60 */ 63 61 NET_ARP_DEVICE, 64 62 /** Address translation message. 65 * @see arp_translate_req()63 * @see arp_translate_req() 66 64 */ 67 65 NET_ARP_TRANSLATE 68 66 } arp_messages; 69 67 70 /** @name ARP specific message parameters definitions 71 */ 68 /** @name ARP specific message parameters definitions */ 72 69 /*@{*/ 73 70 74 71 /** Returns the protocol service message parameter. 75 * @param[in] call The message call structure.72 * @param[in] call The message call structure. 76 73 */ 77 74 #define ARP_GET_NETIF(call) \ 78 ({services_t service = (services_t) IPC_GET_ARG2(*call); service;}) 75 ({ \ 76 services_t service = (services_t) IPC_GET_ARG2(*call); \ 77 service; \ 78 }) 79 79 80 80 /*@}*/ -
uspace/lib/c/include/ipc/devmap.h
r9a1d8ab r0b749a3 40 40 #define DEVMAP_NAME_MAXLEN 255 41 41 42 typedef ipcarg_t dev _handle_t;42 typedef ipcarg_t devmap_handle_t; 43 43 44 44 typedef enum { … … 81 81 82 82 typedef struct { 83 dev _handle_t handle;83 devmap_handle_t handle; 84 84 char name[DEVMAP_NAME_MAXLEN + 1]; 85 85 } dev_desc_t; -
uspace/lib/c/include/ipc/icmp.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup icmp30 * @{29 /** @addtogroup libc 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * ICMP module messages.35 * @see icmp_interface.h34 * ICMP module messages. 35 * @see icmp_interface.h 36 36 */ 37 37 38 #ifndef __NET_ICMP_MESSAGES__39 #define __NET_ICMP_MESSAGES__38 #ifndef LIBC_ICMP_MESSAGES_ 39 #define LIBC_ICMP_MESSAGES_ 40 40 41 41 #include <ipc/ipc.h> 42 #include <ipc/net.h> 42 43 #include <sys/types.h> 44 #include <sys/time.h> 43 45 44 #include <icmp_codes.h> 45 #include <net_messages.h> 46 #include <net/icmp_codes.h> 46 47 47 /** ICMP module messages. 48 */ 49 typedef enum{ 50 /** Sends echo request. 51 * @see icmp_echo() 52 */ 48 /** ICMP module messages. */ 49 typedef enum { 50 /** Sends echo request. @see icmp_echo() */ 53 51 NET_ICMP_ECHO = NET_ICMP_FIRST, 54 /** Sends destination unreachable error message. 55 * @see icmp_destination_unreachable_msg() 52 53 /** 54 * Sends destination unreachable error message. 55 * @see icmp_destination_unreachable_msg() 56 56 */ 57 57 NET_ICMP_DEST_UNREACH, 58 /** Sends source quench error message. 59 * @see icmp_source_quench_msg() 58 59 /** 60 * Sends source quench error message. 61 * @see icmp_source_quench_msg() 60 62 */ 61 63 NET_ICMP_SOURCE_QUENCH, 62 /** Sends time exceeded error message. 63 * @see icmp_time_exceeded_msg() 64 65 /** 66 * Sends time exceeded error message. 67 * @see icmp_time_exceeded_msg() 64 68 */ 65 69 NET_ICMP_TIME_EXCEEDED, 66 /** Sends parameter problem error message. 67 * @see icmp_parameter_problem_msg() 70 71 /** 72 * Sends parameter problem error message. 73 * @see icmp_parameter_problem_msg() 68 74 */ 69 75 NET_ICMP_PARAMETERPROB, 70 /** Initializes new connection.71 */76 77 /** Initializes new connection. */ 72 78 NET_ICMP_INIT 73 79 } icmp_messages; 74 80 75 /** @name ICMP specific message parameters definitions 76 */ 81 /** @name ICMP specific message parameters definitions */ 77 82 /*@{*/ 78 83 79 84 /** Returns the ICMP code message parameter. 80 * @param[in] call The message call structure. 85 * 86 * @param[in] call The message call structure. 81 87 */ 82 88 #define ICMP_GET_CODE(call) \ 83 ({icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); code;}) 89 ({ \ 90 icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); \ 91 code; \ 92 }) 84 93 85 94 /** Returns the ICMP link MTU message parameter. 86 * @param[in] call The message call structure. 95 * 96 * @param[in] call The message call structure. 87 97 */ 88 98 #define ICMP_GET_MTU(call) \ 89 ({icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); mtu;}) 99 ({ \ 100 icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); \ 101 mtu; \ 102 }) 90 103 91 104 /** Returns the pointer message parameter. 92 * @param[in] call The message call structure. 105 * 106 * @param[in] call The message call structure. 93 107 */ 94 108 #define ICMP_GET_POINTER(call) \ 95 ({icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); pointer;}) 109 ({ \ 110 icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); \ 111 pointer; \ 112 }) 96 113 97 114 /** Returns the size message parameter. 98 * @param[in] call The message call structure. 115 * 116 * @param[in] call The message call structure. 99 117 */ 100 118 #define ICMP_GET_SIZE(call) \ 101 ({size_t size = (size_t) IPC_GET_ARG1(call); size;}) 119 ({ \ 120 size_t size = (size_t) IPC_GET_ARG1(call); \ 121 size; \ 122 }) 102 123 103 124 /** Returns the timeout message parameter. 104 * @param[in] call The message call structure. 125 * 126 * @param[in] call The message call structure. 105 127 */ 106 128 #define ICMP_GET_TIMEOUT(call) \ 107 (({suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); timeout;})) 129 ({ \ 130 suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); \ 131 timeout; \ 132 }) 108 133 109 134 /** Returns the time to live message parameter. 110 * @param[in] call The message call structure. 135 * 136 * @param[in] call The message call structure. 111 137 */ 112 138 #define ICMP_GET_TTL(call) \ 113 ({ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); ttl;}) 139 ({ \ 140 ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); \ 141 ttl; \ 142 }) 114 143 115 144 /** Returns the type of service message parameter. 116 * @param[in] call The message call structure. 145 * 146 * @param[in] call The message call structure. 117 147 */ 118 148 #define ICMP_GET_TOS(call) \ 119 ({ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); tos;}) 149 ({ \ 150 ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); \ 151 tos; \ 152 }) 120 153 121 154 /** Returns the dont fragment message parameter. 122 * @param[in] call The message call structure. 155 * 156 * @param[in] call The message call structure. 123 157 */ 124 158 #define ICMP_GET_DONT_FRAGMENT(call) \ 125 ({int dont_fragment = (int) IPC_GET_ARG5(call); dont_fragment;}) 159 ({ \ 160 int dont_fragment = (int) IPC_GET_ARG5(call); \ 161 dont_fragment; \ 162 }) 126 163 127 164 /*@}*/ -
uspace/lib/c/include/ipc/il.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup net_il29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 37 37 */ 38 38 39 #ifndef __NET_IL_MESSAGES_H__40 #define __NET_IL_MESSAGES_H__39 #ifndef LIBC_IL_MESSAGES_H_ 40 #define LIBC_IL_MESSAGES_H_ 41 41 42 42 #include <ipc/ipc.h> 43 #include <ipc/net.h> 43 44 44 /** Internet layer modules messages. 45 */ 45 /** Internet layer modules messages. */ 46 46 typedef enum { 47 47 /** New device message. 48 * @see ip_device_req()48 * @see ip_device_req() 49 49 */ 50 50 NET_IL_DEVICE = NET_IL_FIRST, 51 51 /** Device state changed message. 52 * @see il_device_state_msg()52 * @see il_device_state_msg() 53 53 */ 54 54 NET_IL_DEVICE_STATE, 55 55 /** Device MTU changed message. 56 * @see il_mtu_changed_msg()56 * @see il_mtu_changed_msg() 57 57 */ 58 58 NET_IL_MTU_CHANGED, 59 59 /** Packet size message. 60 * @see il_packet_size_req()60 * @see il_packet_size_req() 61 61 */ 62 62 NET_IL_PACKET_SPACE, 63 63 /** Packet received message. 64 * @see il_received_msg()64 * @see il_received_msg() 65 65 */ 66 66 NET_IL_RECEIVED, 67 67 /** Packet send message. 68 * @see il_send_msg()68 * @see il_send_msg() 69 69 */ 70 70 NET_IL_SEND 71 71 } il_messages; 72 72 73 /** @name Internetwork layer specific message parameters definitions 74 * 75 */ 73 /** @name Internetwork layer specific message parameters definitions */ 76 74 /*@{*/ 77 75 78 76 /** Return the protocol number message parameter. 79 77 * @param[in] call The message call structure. 80 *81 78 */ 82 #define IL_GET_PROTO(call) (int) IPC_GET_ARG1(*call)79 #define IL_GET_PROTO(call) (int) IPC_GET_ARG1(*call) 83 80 84 81 /** Return the registering service message parameter. 85 82 * @param[in] call The message call structure. 86 *87 83 */ 88 #define IL_GET_SERVICE(call) (services_t) IPC_GET_ARG2(*call)84 #define IL_GET_SERVICE(call) (services_t) IPC_GET_ARG2(*call) 89 85 90 86 /*@}*/ -
uspace/lib/c/include/ipc/ip.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup ip30 * @{29 /** @addtogroup libc 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * IP module messages.35 * @see ip_interface.h34 * IP module messages. 35 * @see ip_interface.h 36 36 */ 37 37 38 #ifndef __NET_IP_MESSAGES_H__39 #define __NET_IP_MESSAGES_H__38 #ifndef LIBC_IP_MESSAGES_H_ 39 #define LIBC_IP_MESSAGES_H_ 40 40 41 41 #include <ipc/ipc.h> 42 #include <ipc/net.h> 42 43 43 #include < in.h>44 #include < ip_codes.h>44 #include <net/in.h> 45 #include <net/ip_codes.h> 45 46 46 /** IP module messages. 47 */ 48 typedef enum{ 47 /** IP module messages. */ 48 typedef enum { 49 49 /** Adds the routing entry. 50 * @see ip_add_route()50 * @see ip_add_route() 51 51 */ 52 52 NET_IP_ADD_ROUTE = NET_IP_FIRST, 53 53 /** Gets the actual route information. 54 * @see ip_get_route()54 * @see ip_get_route() 55 55 */ 56 56 NET_IP_GET_ROUTE, 57 57 /** Processes the received error notification. 58 * @see ip_received_error_msg()58 * @see ip_received_error_msg() 59 59 */ 60 60 NET_IP_RECEIVED_ERROR, 61 61 /** Sets the default gateway. 62 * @see ip_set_default_gateway()62 * @see ip_set_default_gateway() 63 63 */ 64 64 NET_IP_SET_GATEWAY 65 65 } ip_messages; 66 66 67 /** @name IP specific message parameters definitions 68 */ 67 /** @name IP specific message parameters definitions */ 69 68 /*@{*/ 70 69 71 70 /** Returns the address message parameter. 72 * @param[in] call The message call structure.71 * @param[in] call The message call structure. 73 72 */ 74 73 #define IP_GET_ADDRESS(call) \ 75 ({in_addr_t addr; addr.s_addr = IPC_GET_ARG3(*call); addr;}) 74 ({ \ 75 in_addr_t addr; \ 76 addr.s_addr = IPC_GET_ARG3(*call); \ 77 addr; \ 78 }) 76 79 77 80 /** Returns the gateway message parameter. 78 * @param[in] call The message call structure.81 * @param[in] call The message call structure. 79 82 */ 80 83 #define IP_GET_GATEWAY(call) \ 81 ({in_addr_t addr; addr.s_addr = IPC_GET_ARG2(*call); addr;}) 84 ({ \ 85 in_addr_t addr; \ 86 addr.s_addr = IPC_GET_ARG2(*call); \ 87 addr; \ 88 }) 82 89 83 90 /** Sets the header length in the message answer. 84 * @param[out] answer The message answer structure.91 * @param[out] answer The message answer structure. 85 92 */ 86 93 #define IP_SET_HEADERLEN(answer, value) \ 87 {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG2(*answer, argument);} 94 do { \ 95 ipcarg_t argument = (ipcarg_t) (value); \ 96 IPC_SET_ARG2(*answer, argument); \ 97 } while (0) 88 98 89 99 /** Returns the network mask message parameter. 90 * @param[in] call The message call structure.100 * @param[in] call The message call structure. 91 101 */ 92 102 #define IP_GET_NETMASK(call) \ 93 ({in_addr_t addr; addr.s_addr = IPC_GET_ARG4(*call); addr;}) 103 ({ \ 104 in_addr_t addr; \ 105 addr.s_addr = IPC_GET_ARG4(*call); \ 106 addr; \ 107 }) 94 108 95 109 /** Returns the protocol message parameter. 96 * @param[in] call The message call structure.110 * @param[in] call The message call structure. 97 111 */ 98 112 #define IP_GET_PROTOCOL(call) \ 99 ({ip_protocol_t protocol = (ip_protocol_t) IPC_GET_ARG1(*call); protocol;}) 113 ({ \ 114 ip_protocol_t protocol = (ip_protocol_t) IPC_GET_ARG1(*call); \ 115 protocol; \ 116 }) 100 117 101 118 /*@}*/ -
uspace/lib/c/include/ipc/net_net.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup net30 * @{29 /** @addtogroup libc 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Networking subsystem central module messages.35 * @see net_interface.h34 * Networking subsystem central module messages. 35 * @see net_interface.h 36 36 */ 37 37 38 #ifndef __NET_NET_MESSAGES_H__39 #define __NET_NET_MESSAGES_H__38 #ifndef LIBC_NET_NET_MESSAGES_H_ 39 #define LIBC_NET_NET_MESSAGES_H_ 40 40 41 41 #include <ipc/ipc.h> 42 #include <ipc/net.h> 42 43 43 #include <net_messages.h> 44 45 /** Networking subsystem central module messages. 46 */ 47 typedef enum{ 44 /** Networking subsystem central module messages. */ 45 typedef enum { 48 46 /** Returns the general configuration 49 * @see net_get_conf_req()47 * @see net_get_conf_req() 50 48 */ 51 49 NET_NET_GET_CONF = NET_FIRST, 52 50 /** Returns the device specific configuration 53 * @see net_get_device_conf_req()51 * @see net_get_device_conf_req() 54 52 */ 55 53 NET_NET_GET_DEVICE_CONF, 56 /** Starts the networking stack. 57 */ 54 /** Starts the networking stack. */ 58 55 NET_NET_STARTUP, 59 56 } net_messages; -
uspace/lib/c/include/ipc/netif.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup netif29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 35 35 */ 36 36 37 #ifndef __NET_NETIF_MESSAGES_H__38 #define __NET_NETIF_MESSAGES_H__37 #ifndef LIBC_NETIF_MESSAGES_H_ 38 #define LIBC_NETIF_MESSAGES_H_ 39 39 40 40 #include <ipc/ipc.h> 41 #include <ipc/net.h> 41 42 42 #include <net_messages.h> 43 44 /** Network interface common module messages. 45 */ 43 /** Network interface common module messages. */ 46 44 typedef enum { 47 45 /** Probe device message. 48 * @see netif_probe_req()46 * @see netif_probe_req() 49 47 */ 50 48 NET_NETIF_PROBE = NET_NETIF_FIRST, 51 49 /** Send packet message. 52 * @see netif_send_msg()50 * @see netif_send_msg() 53 51 */ 54 52 NET_NETIF_SEND, 55 53 /** Start device message. 56 * @see netif_start_req()54 * @see netif_start_req() 57 55 */ 58 56 NET_NETIF_START, 59 57 /** Get device usage statistics message. 60 * @see netif_stats_req()58 * @see netif_stats_req() 61 59 */ 62 60 NET_NETIF_STATS, 63 61 /** Stop device message. 64 * @see netif_stop_req()62 * @see netif_stop_req() 65 63 */ 66 64 NET_NETIF_STOP, 67 65 /** Get device address message. 68 * @see netif_get_addr_req()66 * @see netif_get_addr_req() 69 67 */ 70 68 NET_NETIF_GET_ADDR, 71 69 } netif_messages; 72 70 73 /** @name Network interface specific message parameters definitions 74 */ 71 /** @name Network interface specific message parameters definitions */ 75 72 /*@{*/ 76 73 … … 79 76 */ 80 77 #define NETIF_GET_IRQ(call) \ 81 ({int irq = (int) IPC_GET_ARG2(*call); irq;}) 78 ({ \ 79 int irq = (int) IPC_GET_ARG2(*call); \ 80 irq; \ 81 }) 82 82 83 83 /** Return the input/output address message parameter. … … 85 85 */ 86 86 #define NETIF_GET_IO(call) \ 87 ({int io = (int) IPC_GET_ARG3(*call); io;}) 87 ({ \ 88 int io = (int) IPC_GET_ARG3(*call); \ 89 io; \ 90 }) 88 91 89 92 /*@}*/ -
uspace/lib/c/include/ipc/nil.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup net_nil29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 35 35 */ 36 36 37 #ifndef __NET_NIL_MESSAGES_H__38 #define __NET_NIL_MESSAGES_H__37 #ifndef LIBC_NIL_MESSAGES_H_ 38 #define LIBC_NIL_MESSAGES_H_ 39 39 40 40 #include <ipc/ipc.h> 41 #include <ipc/net.h> 41 42 42 #include <net_messages.h> 43 44 /** Network interface layer module messages. 45 */ 43 /** Network interface layer module messages. */ 46 44 typedef enum { 47 45 /** New device or update MTU message. 48 * @see nil_device_req()46 * @see nil_device_req() 49 47 */ 50 48 NET_NIL_DEVICE = NET_NIL_FIRST, 51 49 /** New device state message. 52 * @see nil_device_state_msg()50 * @see nil_device_state_msg() 53 51 */ 54 52 NET_NIL_DEVICE_STATE, 55 53 /** Received packet queue message. 56 * @see nil_received_msg()54 * @see nil_received_msg() 57 55 */ 58 56 NET_NIL_RECEIVED, 59 57 /** Send packet queue message. 60 * @see nil_send_msg()58 * @see nil_send_msg() 61 59 */ 62 60 NET_NIL_SEND, 63 61 /** Packet size message. 64 * @see nil_packet_size_req()62 * @see nil_packet_size_req() 65 63 */ 66 64 NET_NIL_PACKET_SPACE, 67 65 /** Device local hardware address message. 68 * @see nil_get_addr()66 * @see nil_get_addr() 69 67 */ 70 68 NET_NIL_ADDR, 71 69 /** Device broadcast hardware address message. 72 * @see nil_get_broadcast_addr()70 * @see nil_get_broadcast_addr() 73 71 */ 74 72 NET_NIL_BROADCAST_ADDR, 75 73 } nil_messages; 76 74 77 /** @name Network interface layer specific message parameters definitions 78 */ 75 /** @name Network interface layer specific message parameters definitions */ 79 76 /*@{*/ 80 77 81 /** Return the protocol service message parameter. 82 */ 78 /** Return the protocol service message parameter. */ 83 79 #define NIL_GET_PROTO(call) \ 84 ({services_t service = (services_t) IPC_GET_ARG2(*call); service;}) 80 ({ \ 81 services_t service = (services_t) IPC_GET_ARG2(*call); \ 82 service; \ 83 }) 85 84 86 85 /*@}*/ -
uspace/lib/c/include/ipc/packet.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup packet29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 35 35 */ 36 36 37 #ifndef __NET_PACKET_MESSAGES__38 #define __NET_PACKET_MESSAGES__37 #ifndef LIBC_PACKET_MESSAGES_ 38 #define LIBC_PACKET_MESSAGES_ 39 39 40 40 #include <ipc/ipc.h> 41 #include <ipc/net.h> 41 42 42 #include <net_messages.h> 43 44 /** Packet server module messages. 45 */ 43 /** Packet server module messages. */ 46 44 typedef enum { 47 45 /** Create packet message with specified content length. 48 * @see packet_get_1()46 * @see packet_get_1() 49 47 */ 50 48 NET_PACKET_CREATE_1 = NET_PACKET_FIRST, 51 /** Create packet message with specified address length, prefix, content and suffix. 52 * @see packet_get_4() 49 50 /** 51 * Create packet message with specified address length, prefix, content 52 * and suffix. 53 * @see packet_get_4() 53 54 */ 54 55 NET_PACKET_CREATE_4, 56 55 57 /** Get packet message. 56 * @see packet_return() 57 */ 58 * @see packet_return() */ 58 59 NET_PACKET_GET, 60 59 61 /** Get packet size message. 60 * @see packet_translate()62 * @see packet_translate() 61 63 */ 62 64 NET_PACKET_GET_SIZE, 65 63 66 /** Release packet message. 64 * @see pq_release()67 * @see pq_release() 65 68 */ 66 69 NET_PACKET_RELEASE 67 70 } packet_messages; 68 71 69 /** Returns the protocol service message parameter. 70 */ 71 #define ARP_GET_PROTO(call) (services_t) IPC_GET_ARG2(*call) 72 /** Returns the protocol service message parameter. */ 73 #define ARP_GET_PROTO(call) (services_t) IPC_GET_ARG2(*call) 72 74 73 /** Returns the packet identifier message parameter. 74 */ 75 #define IPC_GET_ID(call) (packet_id_t) IPC_GET_ARG1(*call) 75 /** Returns the packet identifier message parameter. */ 76 #define IPC_GET_ID(call) (packet_id_t) IPC_GET_ARG1(*call) 76 77 77 /** Returns the maximal content length message parameter. 78 */ 79 #define IPC_GET_CONTENT(call) (size_t) IPC_GET_ARG1(*call) 78 /** Returns the maximal content length message parameter. */ 79 #define IPC_GET_CONTENT(call) (size_t) IPC_GET_ARG1(*call) 80 80 81 /** Returns the maximal address length message parameter. 82 */ 81 /** Returns the maximal address length message parameter. */ 83 82 #define IPC_GET_ADDR_LEN(call) (size_t) IPC_GET_ARG2(*call) 84 83 85 /** Returns the maximal prefix length message parameter. 86 */ 87 #define IPC_GET_PREFIX(call) (size_t) IPC_GET_ARG3(*call) 84 /** Returns the maximal prefix length message parameter. */ 85 #define IPC_GET_PREFIX(call) (size_t) IPC_GET_ARG3(*call) 88 86 89 /** Returns the maximal suffix length message parameter. 90 */ 91 #define IPC_GET_SUFFIX(call) (size_t) IPC_GET_ARG4(*call) 87 /** Returns the maximal suffix length message parameter. */ 88 #define IPC_GET_SUFFIX(call) (size_t) IPC_GET_ARG4(*call) 92 89 93 90 #endif -
uspace/lib/c/include/ipc/services.h
r9a1d8ab r0b749a3 39 39 40 40 typedef enum { 41 SERVICE_LOAD = 1, 41 SERVICE_NONE = 0, 42 SERVICE_LOAD, 42 43 SERVICE_PCI, 43 44 SERVICE_VIDEO, … … 45 46 SERVICE_VFS, 46 47 SERVICE_DEVMAP, 48 SERVICE_DEVMAN, 47 49 SERVICE_FHC, 48 50 SERVICE_OBIO, -
uspace/lib/c/include/ipc/socket.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup socket30 * @{29 /** @addtogroup libc 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Socket messages. 35 * @see socket.h 36 */ 37 38 39 #ifndef __NET_SOCKET_MESSAGES_H__ 40 #define __NET_SOCKET_MESSAGES_H__ 34 * Socket messages. 35 */ 36 37 #ifndef LIBC_SOCKET_MESSAGES_H_ 38 #define LIBC_SOCKET_MESSAGES_H_ 41 39 42 40 #include <ipc/ipc.h> 43 44 #include <net_messages.h> 45 #include <socket_codes.h> 46 47 /** Socket client messages. 48 */ 49 typedef enum{ 50 /** Creates a new socket. 51 * @see socket() 52 */ 41 #include <ipc/net.h> 42 43 /** Socket client messages. */ 44 typedef enum { 45 /** Creates a new socket. @see socket() */ 53 46 NET_SOCKET = NET_SOCKET_FIRST, 54 /** Binds the socket. 55 * @see bind() 56 */ 47 /** Binds the socket. @see bind() */ 57 48 NET_SOCKET_BIND, 58 /** Creates a new socket. 59 * @see socket() 60 */ 49 /** Creates a new socket. @see socket() */ 61 50 NET_SOCKET_LISTEN, 62 /** Accepts an incomming connection. 63 * @see accept() 64 */ 51 /** Accepts an incomming connection. @see accept() */ 65 52 NET_SOCKET_ACCEPT, 66 /** Connects the socket. 67 * @see connect() 68 */ 53 /** Connects the socket. @see connect() */ 69 54 NET_SOCKET_CONNECT, 70 /** Closes the socket. 71 * @see closesocket() 72 */ 55 /** Closes the socket. @see closesocket() */ 73 56 NET_SOCKET_CLOSE, 74 /** Sends data via the stream socket. 75 * @see send() 76 */ 57 /** Sends data via the stream socket. @see send() */ 77 58 NET_SOCKET_SEND, 78 /** Sends data via the datagram socket. 79 * @see sendto() 80 */ 59 /** Sends data via the datagram socket. @see sendto() */ 81 60 NET_SOCKET_SENDTO, 82 /** Receives data from the stream socket. 83 * @see socket() 84 */ 61 /** Receives data from the stream socket. @see socket() */ 85 62 NET_SOCKET_RECV, 86 /** Receives data from the datagram socket. 87 * @see socket() 88 */ 63 /** Receives data from the datagram socket. @see socket() */ 89 64 NET_SOCKET_RECVFROM, 90 /** Gets the socket option. 91 * @see getsockopt() 92 */ 65 /** Gets the socket option. @see getsockopt() */ 93 66 NET_SOCKET_GETSOCKOPT, 94 /** Sets the socket option. 95 * @see setsockopt() 96 */ 67 /** Sets the socket option. @see setsockopt() */ 97 68 NET_SOCKET_SETSOCKOPT, 98 /** New socket for acceptence notification message. 99 */ 69 /** New socket for acceptence notification message. */ 100 70 NET_SOCKET_ACCEPTED, 101 /** New data received notification message. 102 */ 71 /** New data received notification message. */ 103 72 NET_SOCKET_RECEIVED, 104 /** New socket data fragment size notification message. 105 */ 73 /** New socket data fragment size notification message. */ 106 74 NET_SOCKET_DATA_FRAGMENT_SIZE 107 75 } socket_messages; … … 112 80 113 81 /** Sets the socket identifier in the message answer. 114 * @param[out] answerThe message answer structure.82 * @param[out] answer The message answer structure. 115 83 */ 116 84 #define SOCKET_SET_SOCKET_ID(answer, value) \ 117 {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG1(answer, argument);} 85 do { \ 86 ipcarg_t argument = (ipcarg_t) (value); \ 87 IPC_SET_ARG1(answer, argument); \ 88 } while (0) 118 89 119 90 /** Returns the socket identifier message parameter. 120 * @param[in] callThe message call structure.91 * @param[in] call The message call structure. 121 92 */ 122 93 #define SOCKET_GET_SOCKET_ID(call) \ 123 ({int socket_id = (int) IPC_GET_ARG1(call); socket_id;}) 94 ({ \ 95 int socket_id = (int) IPC_GET_ARG1(call); \ 96 socket_id; \ 97 }) 124 98 125 99 /** Sets the read data length in the message answer. 126 * @param[out] answerThe message answer structure.100 * @param[out] answer The message answer structure. 127 101 */ 128 102 #define SOCKET_SET_READ_DATA_LENGTH(answer, value) \ 129 {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG1(answer, argument);} 103 do { \ 104 ipcarg_t argument = (ipcarg_t) (value); \ 105 IPC_SET_ARG1(answer, argument); \ 106 } while (0) 130 107 131 108 /** Returns the read data length message parameter. 132 * @param[in] callThe message call structure.109 * @param[in] call The message call structure. 133 110 */ 134 111 #define SOCKET_GET_READ_DATA_LENGTH(call) \ 135 ({int data_length = (int) IPC_GET_ARG1(call); data_length;}) 112 ({ \ 113 int data_length = (int) IPC_GET_ARG1(call); \ 114 data_length; \ 115 }) 136 116 137 117 /** Returns the backlog message parameter. 138 * @param[in] callThe message call structure.118 * @param[in] call The message call structure. 139 119 */ 140 120 #define SOCKET_GET_BACKLOG(call) \ 141 ({int backlog = (int) IPC_GET_ARG2(call); backlog;}) 121 ({ \ 122 int backlog = (int) IPC_GET_ARG2(call); \ 123 backlog; \ 124 }) 142 125 143 126 /** Returns the option level message parameter. 144 * @param[in] callThe message call structure.127 * @param[in] call The message call structure. 145 128 */ 146 129 #define SOCKET_GET_OPT_LEVEL(call) \ 147 ({int opt_level = (int) IPC_GET_ARG2(call); opt_level;}) 130 ({ \ 131 int opt_level = (int) IPC_GET_ARG2(call); \ 132 opt_level; \ 133 }) 148 134 149 135 /** Returns the data fragment size message parameter. 150 * @param[in] callThe message call structure.136 * @param[in] call The message call structure. 151 137 */ 152 138 #define SOCKET_GET_DATA_FRAGMENT_SIZE(call) \ 153 ({size_t size = (size_t) IPC_GET_ARG2(call); size;}) 139 ({ \ 140 size_t size = (size_t) IPC_GET_ARG2(call); \ 141 size; \ 142 }) 154 143 155 144 /** Sets the data fragment size in the message answer. 156 * @param[out] answerThe message answer structure.145 * @param[out] answer The message answer structure. 157 146 */ 158 147 #define SOCKET_SET_DATA_FRAGMENT_SIZE(answer, value) \ 159 {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG2(answer, argument);} 148 do { \ 149 ipcarg_t argument = (ipcarg_t) (value); \ 150 IPC_SET_ARG2(answer, argument); \ 151 } while (0) 160 152 161 153 /** Sets the address length in the message answer. 162 * @param[out] answerThe message answer structure.154 * @param[out] answer The message answer structure. 163 155 */ 164 156 #define SOCKET_SET_ADDRESS_LENGTH(answer, value) \ 165 {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG3(answer, argument);} 157 do { \ 158 ipcarg_t argument = (ipcarg_t) (value); \ 159 IPC_SET_ARG3(answer, argument);\ 160 } while (0) 166 161 167 162 /** Returns the address length message parameter. 168 * @param[in] callThe message call structure.163 * @param[in] call The message call structure. 169 164 */ 170 165 #define SOCKET_GET_ADDRESS_LENGTH(call) \ 171 ({socklen_t address_length = (socklen_t) IPC_GET_ARG3(call); address_length;}) 166 ({ \ 167 socklen_t address_length = (socklen_t) IPC_GET_ARG3(call); \ 168 address_length; \ 169 }) 172 170 173 171 /** Sets the header size in the message answer. 174 * @param[out] answerThe message answer structure.172 * @param[out] answer The message answer structure. 175 173 */ 176 174 #define SOCKET_SET_HEADER_SIZE(answer, value) \ 177 \ 178 {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG3(answer, argument);} 175 do { \ 176 ipcarg_t argument = (ipcarg_t) (value); \ 177 IPC_SET_ARG3(answer, argument); \ 178 } while (0) 179 179 180 180 /** Returns the header size message parameter. 181 * @param[in] call The message call structure.181 * @param[in] call The message call structure. 182 182 */ 183 183 #define SOCKET_GET_HEADER_SIZE(call) \ 184 ({size_t size = (size_t) IPC_GET_ARG3(call); size;}) 184 ({ \ 185 size_t size = (size_t) IPC_GET_ARG3(call); \ 186 size; \ 187 }) 185 188 186 189 /** Returns the flags message parameter. 187 * @param[in] call The message call structure.190 * @param[in] call The message call structure. 188 191 */ 189 192 #define SOCKET_GET_FLAGS(call) \ 190 ({int flags = (int) IPC_GET_ARG4(call); flags;}) 193 ({ \ 194 int flags = (int) IPC_GET_ARG4(call); \ 195 flags; \ 196 }) 191 197 192 198 /** Returns the option name message parameter. 193 * @param[in] call The message call structure.199 * @param[in] call The message call structure. 194 200 */ 195 201 #define SOCKET_GET_OPT_NAME(call) \ 196 ({int opt_name = (int) IPC_GET_ARG4(call); opt_name;}) 202 ({ \ 203 int opt_name = (int) IPC_GET_ARG4(call); \ 204 opt_name; \ 205 }) 197 206 198 207 /** Returns the data fragments message parameter. 199 * @param[in] call The message call structure.208 * @param[in] call The message call structure. 200 209 */ 201 210 #define SOCKET_GET_DATA_FRAGMENTS(call) \ 202 ({int fragments = (int) IPC_GET_ARG5(call); fragments;}) 211 ({ \ 212 int fragments = (int) IPC_GET_ARG5(call); \ 213 fragments; \ 214 }) 203 215 204 216 /** Returns the new socket identifier message parameter. 205 * @param[in] call The message call structure.217 * @param[in] call The message call structure. 206 218 */ 207 219 #define SOCKET_GET_NEW_SOCKET_ID(call) \ 208 ({int socket_id = (int) IPC_GET_ARG5(call); socket_id;}) 220 ({ \ 221 int socket_id = (int) IPC_GET_ARG5(call); \ 222 socket_id; \ 223 }) 209 224 210 225 /*@}*/ -
uspace/lib/c/include/ipc/tl.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup net_tl30 * @{29 /** @addtogroup libc 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Transport layer modules messages.35 * @see tl_interface.h34 * Transport layer modules messages. 35 * @see tl_interface.h 36 36 */ 37 37 38 #ifndef __NET_TL_MESSAGES_H__39 #define __NET_TL_MESSAGES_H__38 #ifndef LIBC_TL_MESSAGES_H_ 39 #define LIBC_TL_MESSAGES_H_ 40 40 41 41 #include <ipc/ipc.h> 42 #include <ipc/net.h> 42 43 43 #include <net_messages.h> 44 45 /** Transport layer modules messages. 46 */ 47 typedef enum{ 44 /** Transport layer modules messages. */ 45 typedef enum { 48 46 /** Packet received message. 49 * @see tl_received_msg()47 * @see tl_received_msg() 50 48 */ 51 49 NET_TL_RECEIVED = NET_TL_FIRST -
uspace/lib/c/include/net/device.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup netif30 * @{29 /** @addtogroup libc 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Device identifier, state and usage statistics.34 * Device identifier, state and usage statistics. 35 35 */ 36 36 37 #ifndef __NET_DEVICE_ID_TYPE_H__38 #define __NET_DEVICE_ID_TYPE_H__37 #ifndef LIBC_DEVICE_ID_TYPE_H_ 38 #define LIBC_DEVICE_ID_TYPE_H_ 39 39 40 40 #include <adt/int_map.h> 41 41 42 /** Device identifier to generic type map declaration. 43 */ 44 #define DEVICE_MAP_DECLARE INT_MAP_DECLARE 42 /** Device identifier to generic type map declaration. */ 43 #define DEVICE_MAP_DECLARE INT_MAP_DECLARE 45 44 46 /** Device identifier to generic type map implementation. 47 */ 45 /** Device identifier to generic type map implementation. */ 48 46 #define DEVICE_MAP_IMPLEMENT INT_MAP_IMPLEMENT 49 47 50 /** Invalid device identifier. 51 */ 52 #define DEVICE_INVALID_ID (-1) 48 /** Invalid device identifier. */ 49 #define DEVICE_INVALID_ID (-1) 53 50 54 /** Device identifier type. 55 */ 56 typedef int device_id_t; 51 /** Device identifier type. */ 52 typedef int device_id_t; 57 53 58 /** Device state type. 59 */ 60 typedef enum device_state device_state_t; 54 /** Device state type. */ 55 typedef enum device_state device_state_t; 61 56 62 57 /** Type definition of the device usage statistics. 63 * @see device_stats58 * @see device_stats 64 59 */ 65 typedef struct device_stats device_stats_t;60 typedef struct device_stats device_stats_t; 66 61 67 /** Type definition of the device usage statistics pointer. 68 * @see device_stats 69 */ 70 typedef device_stats_t * device_stats_ref; 71 72 /** Device state. 73 */ 74 enum device_state{ 75 /** Device not present or not initialized. 76 */ 62 /** Device state. */ 63 enum device_state { 64 /** Device not present or not initialized. */ 77 65 NETIF_NULL = 0, 78 /** Device present and stopped. 79 */ 66 /** Device present and stopped. */ 80 67 NETIF_STOPPED, 81 /** Device present and active. 82 */ 68 /** Device present and active. */ 83 69 NETIF_ACTIVE, 84 /** Device present but unable to transmit. 85 */ 70 /** Device present but unable to transmit. */ 86 71 NETIF_CARRIER_LOST 87 72 }; 88 73 89 /** Device usage statistics. 90 */ 91 struct device_stats{ 92 /** Total packets received. 93 */ 74 /** Device usage statistics. */ 75 struct device_stats { 76 /** Total packets received. */ 94 77 unsigned long receive_packets; 95 /** Total packets transmitted. 96 */ 78 /** Total packets transmitted. */ 97 79 unsigned long send_packets; 98 /** Total bytes received. 99 */ 80 /** Total bytes received. */ 100 81 unsigned long receive_bytes; 101 /** Total bytes transmitted. 102 */ 82 /** Total bytes transmitted. */ 103 83 unsigned long send_bytes; 104 /** Bad packets received counter. 105 */ 84 /** Bad packets received counter. */ 106 85 unsigned long receive_errors; 107 /** Packet transmition problems counter. 108 */ 86 /** Packet transmition problems counter. */ 109 87 unsigned long send_errors; 110 /** No space in buffers counter. 111 */ 88 /** No space in buffers counter. */ 112 89 unsigned long receive_dropped; 113 /** No space available counter. 114 */ 90 /** No space available counter. */ 115 91 unsigned long send_dropped; 116 /** Total multicast packets received. 117 */ 92 /** Total multicast packets received. */ 118 93 unsigned long multicast; 119 /** The number of collisions due to congestion on the medium. 120 */ 94 /** The number of collisions due to congestion on the medium. */ 121 95 unsigned long collisions; 122 96 123 /* detailed receive_errors :*/124 /** Received packet length error counter. 125 */97 /* detailed receive_errors */ 98 99 /** Received packet length error counter. */ 126 100 unsigned long receive_length_errors; 127 /** Receiver buffer overflow counter. 128 */ 101 /** Receiver buffer overflow counter. */ 129 102 unsigned long receive_over_errors; 130 /** Received packet with crc error counter. 131 */ 103 /** Received packet with crc error counter. */ 132 104 unsigned long receive_crc_errors; 133 /** Received frame alignment error counter. 134 */ 105 /** Received frame alignment error counter. */ 135 106 unsigned long receive_frame_errors; 136 /** Receiver fifo overrun counter. 137 */ 107 /** Receiver fifo overrun counter. */ 138 108 unsigned long receive_fifo_errors; 139 /** Receiver missed packet counter. 140 */ 109 /** Receiver missed packet counter. */ 141 110 unsigned long receive_missed_errors; 142 111 143 112 /* detailed send_errors */ 144 /** Transmitter aborted counter. 145 */113 114 /** Transmitter aborted counter. */ 146 115 unsigned long send_aborted_errors; 147 /** Transmitter carrier errors counter. 148 */ 116 /** Transmitter carrier errors counter. */ 149 117 unsigned long send_carrier_errors; 150 /** Transmitter fifo overrun counter. 151 */ 118 /** Transmitter fifo overrun counter. */ 152 119 unsigned long send_fifo_errors; 153 /** Transmitter carrier errors counter. 154 */ 120 /** Transmitter carrier errors counter. */ 155 121 unsigned long send_heartbeat_errors; 156 /** Transmitter window errors counter. 157 */ 122 /** Transmitter window errors counter. */ 158 123 unsigned long send_window_errors; 159 124 160 125 /* for cslip etc */ 161 /** Total compressed packets received.162 */126 127 /** Total compressed packets received. */ 163 128 unsigned long receive_compressed; 164 /** Total compressed packet transmitted. 165 */ 129 /** Total compressed packet transmitted. */ 166 130 unsigned long send_compressed; 167 131 }; … … 171 135 /** @} 172 136 */ 173 -
uspace/lib/c/include/net/icmp_codes.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup icmp29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * ICMP types and codes according to the on-line IANA - ICMP Type Numbers - <http://http://www.iana.org/assignments/icmp-parameters>, cited September 14 2009. 35 */ 36 37 #ifndef __NET_ICMP_CODES_H__ 38 #define __NET_ICMP_CODES_H__ 39 40 /** ICMP type type definition. 41 */ 42 typedef uint8_t icmp_type_t; 43 44 /** ICMP code type definition. 45 */ 46 typedef uint8_t icmp_code_t; 47 48 /** ICMP parameter type definition. 49 */ 50 typedef uint16_t icmp_param_t; 51 52 /** @name ICMP types definitions 53 */ 54 /*@{*/ 55 56 /** Echo Reply. 57 */ 34 * ICMP types and codes according to the on-line IANA - ICMP Type Numbers 35 * 36 * http://www.iana.org/assignments/icmp-parameters> 37 * 38 * cited September 14 2009. 39 */ 40 41 #ifndef LIBC_ICMP_CODES_H_ 42 #define LIBC_ICMP_CODES_H_ 43 44 #include <sys/types.h> 45 46 /** ICMP type type definition. */ 47 typedef uint8_t icmp_type_t; 48 49 /** ICMP code type definition. */ 50 typedef uint8_t icmp_code_t; 51 52 /** ICMP parameter type definition. */ 53 typedef uint16_t icmp_param_t; 54 55 /** @name ICMP types definitions */ 56 /*@{*/ 57 58 /** Echo Reply. */ 58 59 #define ICMP_ECHOREPLY 0 59 60 60 /** Destination Unreachable. 61 */ 61 /** Destination Unreachable. */ 62 62 #define ICMP_DEST_UNREACH 3 63 63 64 /** Source Quench. 65 */ 64 /** Source Quench. */ 66 65 #define ICMP_SOURCE_QUENCH 4 67 66 68 /** Redirect. 69 */ 67 /** Redirect. */ 70 68 #define ICMP_REDIRECT 5 71 69 72 /** Alternate Host Address. 73 */ 70 /** Alternate Host Address. */ 74 71 #define ICMP_ALTERNATE_ADDR 6 75 72 76 /** Echo Request. 77 */ 78 #define ICMP_ECHO 8 79 80 /** Router Advertisement. 81 */ 73 /** Echo Request. */ 74 #define ICMP_ECHO 8 75 76 /** Router Advertisement. */ 82 77 #define ICMP_ROUTER_ADV 9 83 78 84 /** Router solicitation. 85 */ 79 /** Router solicitation. */ 86 80 #define ICMP_ROUTER_SOL 10 87 81 88 /** Time Exceeded. 89 */ 82 /** Time Exceeded. */ 90 83 #define ICMP_TIME_EXCEEDED 11 91 84 92 /** Parameter Problem. 93 */ 85 /** Parameter Problem. */ 94 86 #define ICMP_PARAMETERPROB 12 95 87 96 /** Timestamp Request. 97 */ 88 /** Timestamp Request. */ 98 89 #define ICMP_TIMESTAMP 13 99 90 100 /** Timestamp Reply. 101 */ 91 /** Timestamp Reply. */ 102 92 #define ICMP_TIMESTAMPREPLY 14 103 93 104 /** Information Request. 105 */ 94 /** Information Request. */ 106 95 #define ICMP_INFO_REQUEST 15 107 96 108 /** Information Reply. 109 */ 97 /** Information Reply. */ 110 98 #define ICMP_INFO_REPLY 16 111 99 112 /** Address Mask Request. 113 */ 100 /** Address Mask Request. */ 114 101 #define ICMP_ADDRESS 17 115 102 116 /** Address Mask Reply. 117 */ 103 /** Address Mask Reply. */ 118 104 #define ICMP_ADDRESSREPLY 18 119 105 120 /** Traceroute. 121 */ 106 /** Traceroute. */ 122 107 #define ICMP_TRACEROUTE 30 123 108 124 /** Datagram Conversion Error. 125 */ 109 /** Datagram Conversion Error. */ 126 110 #define ICMP_CONVERSION_ERROR 31 127 111 128 /** Mobile Host Redirect. 129 */ 112 /** Mobile Host Redirect. */ 130 113 #define ICMP_REDIRECT_MOBILE 32 131 114 132 /** IPv6 Where-Are-You. 133 */ 115 /** IPv6 Where-Are-You. */ 134 116 #define ICMP_IPV6_WHERE_ARE_YOU 33 135 117 136 /** IPv6 I-Am-Here. 137 */ 118 /** IPv6 I-Am-Here. */ 138 119 #define ICMP_IPV6_I_AM_HERE 34 139 120 140 /** Mobile Registration Request. 141 */ 121 /** Mobile Registration Request. */ 142 122 #define ICMP_MOBILE_REQUEST 35 143 123 144 /** Mobile Registration Reply. 145 */ 124 /** Mobile Registration Reply. */ 146 125 #define ICMP_MOBILE_REPLY 36 147 126 148 /** Domain name request. 149 */ 127 /** Domain name request. */ 150 128 #define ICMP_DN_REQUEST 37 151 129 152 /** Domain name reply. 153 */ 130 /** Domain name reply. */ 154 131 #define ICMP_DN_REPLY 38 155 132 156 /** SKIP. 157 */ 158 #define ICMP_SKIP 39 159 160 /** Photuris. 161 */ 133 /** SKIP. */ 134 #define ICMP_SKIP 39 135 136 /** Photuris. */ 162 137 #define ICMP_PHOTURIS 40 163 138 … … 168 143 /*@{*/ 169 144 170 /** Network Unreachable. 171 */ 145 /** Network Unreachable. */ 172 146 #define ICMP_NET_UNREACH 0 173 147 174 /** Host Unreachable. 175 */ 148 /** Host Unreachable. */ 176 149 #define ICMP_HOST_UNREACH 1 177 150 178 /** Protocol Unreachable. 179 */ 151 /** Protocol Unreachable. */ 180 152 #define ICMP_PROT_UNREACH 2 181 153 182 /** Port Unreachable. 183 */ 154 /** Port Unreachable. */ 184 155 #define ICMP_PORT_UNREACH 3 185 156 186 /** Fragmentation needed but the Do Not Fragment bit was set. 187 */ 157 /** Fragmentation needed but the Do Not Fragment bit was set. */ 188 158 #define ICMP_FRAG_NEEDED 4 189 159 190 /** Source Route failed. 191 */ 160 /** Source Route failed. */ 192 161 #define ICMP_SR_FAILED 5 193 162 194 /** Destination network unknown. 195 */ 163 /** Destination network unknown. */ 196 164 #define ICMP_NET_UNKNOWN 6 197 165 198 /** Destination host unknown. 199 */ 166 /** Destination host unknown. */ 200 167 #define ICMP_HOST_UNKNOWN 7 201 168 202 /** Source host isolated (obsolete). 203 */ 169 /** Source host isolated (obsolete). */ 204 170 #define ICMP_HOST_ISOLATED 8 205 171 206 /** Destination network administratively prohibited. 207 */ 172 /** Destination network administratively prohibited. */ 208 173 #define ICMP_NET_ANO 9 209 174 210 /** Destination host administratively prohibited. 211 */ 175 /** Destination host administratively prohibited. */ 212 176 #define ICMP_HOST_ANO 10 213 177 214 /** Network unreachable for this type of service. 215 */ 178 /** Network unreachable for this type of service. */ 216 179 #define ICMP_NET_UNR_TOS 11 217 180 218 /** Host unreachable for this type of service. 219 */ 181 /** Host unreachable for this type of service. */ 220 182 #define ICMP_HOST_UNR_TOS 12 221 183 222 /** Communication administratively prohibited by filtering. 223 */ 184 /** Communication administratively prohibited by filtering. */ 224 185 #define ICMP_PKT_FILTERED 13 225 186 226 /** Host precedence violation. 227 */ 187 /** Host precedence violation. */ 228 188 #define ICMP_PREC_VIOLATION 14 229 189 230 /** Precedence cutoff in effect. 231 */ 190 /** Precedence cutoff in effect. */ 232 191 #define ICMP_PREC_CUTOFF 15 233 192 234 193 /*@}*/ 235 194 236 /** @name ICMP_REDIRECT codes definitions 237 */ 238 /*@{*/ 239 240 /** Network redirect (or subnet). 241 */ 195 /** @name ICMP_REDIRECT codes definitions */ 196 /*@{*/ 197 198 /** Network redirect (or subnet). */ 242 199 #define ICMP_REDIR_NET 0 243 200 244 /** Host redirect. 245 */ 201 /** Host redirect. */ 246 202 #define ICMP_REDIR_HOST 1 247 203 248 /** Network redirect for this type of service. 249 */ 204 /** Network redirect for this type of service. */ 250 205 #define ICMP_REDIR_NETTOS 2 251 206 252 /** Host redirect for this type of service. 253 */ 207 /** Host redirect for this type of service. */ 254 208 #define ICMP_REDIR_HOSTTOS 3 255 209 256 210 /*@}*/ 257 211 258 /** @name ICMP_ALTERNATE_ADDRESS codes definitions 259 */ 260 /*@{*/ 261 262 /** Alternate address for host. 263 */ 212 /** @name ICMP_ALTERNATE_ADDRESS codes definitions */ 213 /*@{*/ 214 215 /** Alternate address for host. */ 264 216 #define ICMP_ALTERNATE_HOST 0 265 217 266 218 /*@}*/ 267 219 268 /** @name ICMP_ROUTER_ADV codes definitions 269 */ 270 /*@{*/ 271 272 /** Normal router advertisement. 273 */ 220 /** @name ICMP_ROUTER_ADV codes definitions */ 221 /*@{*/ 222 223 /** Normal router advertisement. */ 274 224 #define ICMP_ROUTER_NORMAL 0 275 225 276 /** Does not route common traffic. 277 */ 226 /** Does not route common traffic. */ 278 227 #define ICMP_ROUTER_NO_NORMAL_TRAFFIC 16 279 228 280 229 /*@}*/ 281 230 282 /** @name ICMP_TIME_EXCEEDED codes definitions 283 */ 284 /*@{*/ 285 286 /** Transit TTL exceeded. 287 */ 231 /** @name ICMP_TIME_EXCEEDED codes definitions */ 232 /*@{*/ 233 234 /** Transit TTL exceeded. */ 288 235 #define ICMP_EXC_TTL 0 289 236 290 /** Reassembly TTL exceeded. 291 */ 237 /** Reassembly TTL exceeded. */ 292 238 #define ICMP_EXC_FRAGTIME 1 293 239 294 240 /*@}*/ 295 241 296 /** @name ICMP_PARAMETERPROB codes definitions 297 */ 298 /*@{*/ 299 300 /** Pointer indicates the error. 301 */ 242 /** @name ICMP_PARAMETERPROB codes definitions */ 243 /*@{*/ 244 245 /** Pointer indicates the error. */ 302 246 #define ICMP_PARAM_POINTER 0 303 247 304 /** Missing required option. 305 */ 248 /** Missing required option. */ 306 249 #define ICMP_PARAM_MISSING 1 307 250 308 /** Bad length. 309 */ 251 /** Bad length. */ 310 252 #define ICMP_PARAM_LENGTH 2 311 253 312 254 /*@}*/ 313 255 314 /** @name ICMP_PHOTURIS codes definitions 315 */ 316 /*@{*/ 317 318 /** Bad SPI. 319 */ 320 #define ICMP_PHOTURIS_BAD_SPI 0 321 322 /** Authentication failed. 323 */ 324 #define ICMP_PHOTURIS_AUTHENTICATION 1 325 326 /** Decompression failed. 327 */ 256 /** @name ICMP_PHOTURIS codes definitions */ 257 /*@{*/ 258 259 /** Bad SPI. */ 260 #define ICMP_PHOTURIS_BAD_SPI 0 261 262 /** Authentication failed. */ 263 #define ICMP_PHOTURIS_AUTHENTICATION 1 264 265 /** Decompression failed. */ 328 266 #define ICMP_PHOTURIS_DECOMPRESSION 2 329 267 330 /** Decryption failed. 331 */ 332 #define ICMP_PHOTURIS_DECRYPTION 3 333 334 /** Need authentication. 335 */ 268 /** Decryption failed. */ 269 #define ICMP_PHOTURIS_DECRYPTION 3 270 271 /** Need authentication. */ 336 272 #define ICMP_PHOTURIS_NEED_AUTHENTICATION 4 337 273 338 /** Need authorization. 339 */ 274 /** Need authorization. */ 340 275 #define ICMP_PHOTURIS_NEED_AUTHORIZATION 5 341 276 -
uspace/lib/c/include/net/in.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup net29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 35 35 */ 36 36 37 #ifndef __NET_IN_H__38 #define __NET_IN_H__37 #ifndef LIBC_IN_H_ 38 #define LIBC_IN_H_ 39 39 40 #include <net/inet.h> 41 #include <net/ip_protocols.h> 40 42 #include <sys/types.h> 41 43 42 #include <ip_protocols.h> 43 #include <inet.h> 44 45 /** INET string address maximum length. 46 */ 44 /** INET string address maximum length. */ 47 45 #define INET_ADDRSTRLEN (4 * 3 + 3 + 1) 48 46 49 47 /** Type definition of the INET address. 50 * @see in_addr48 * @see in_addr 51 49 */ 52 50 typedef struct in_addr in_addr_t; 53 51 54 52 /** Type definition of the INET socket address. 55 * @see sockaddr_in53 * @see sockaddr_in 56 54 */ 57 55 typedef struct sockaddr_in sockaddr_in_t; 58 56 59 /** INET address. 60 */ 61 struct in_addr{ 62 /** 4 byte IP address. 63 */ 57 /** INET address. */ 58 struct in_addr { 59 /** 4 byte IP address. */ 64 60 uint32_t s_addr; 65 61 }; 66 62 67 63 /** INET socket address. 68 * @see sockaddr64 * @see sockaddr 69 65 */ 70 struct sockaddr_in{ 71 /** Address family. 72 * Should be AF_INET. 73 */ 66 struct sockaddr_in { 67 /** Address family. Should be AF_INET. */ 74 68 uint16_t sin_family; 75 /** Port number. 76 */ 69 /** Port number. */ 77 70 uint16_t sin_port; 78 /** Internet address. 79 */ 71 /** Internet address. */ 80 72 struct in_addr sin_addr; 81 /** Padding to meet the sockaddr size. 82 */ 73 /** Padding to meet the sockaddr size. */ 83 74 uint8_t sin_zero[8]; 84 75 }; -
uspace/lib/c/include/net/in6.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup net29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 35 35 */ 36 36 37 #ifndef __NET_IN6_H__38 #define __NET_IN6_H__37 #ifndef LIBC_IN6_H_ 38 #define LIBC_IN6_H_ 39 39 40 #include <net/inet.h> 41 #include <net/ip_protocols.h> 40 42 #include <sys/types.h> 41 43 42 #include <ip_protocols.h> 43 #include <inet.h> 44 45 /** INET6 string address maximum length. 46 */ 44 /** INET6 string address maximum length. */ 47 45 #define INET6_ADDRSTRLEN (8 * 4 + 7 + 1) 48 46 49 47 /** Type definition of the INET6 address. 50 * @see in6_addr48 * @see in6_addr 51 49 */ 52 50 typedef struct in6_addr in6_addr_t; 53 51 54 52 /** Type definition of the INET6 socket address. 55 * @see sockaddr_in653 * @see sockaddr_in6 56 54 */ 57 55 typedef struct sockaddr_in6 sockaddr_in6_t; 58 56 59 /** INET6 address. 60 */ 61 struct in6_addr{ 62 /** 16 byte IPv6 address. 63 */ 57 /** INET6 address. */ 58 struct in6_addr { 59 /** 16 byte IPv6 address. */ 64 60 unsigned char s6_addr[16]; 65 61 }; 66 62 67 63 /** INET6 socket address. 68 * @see sockaddr64 * @see sockaddr 69 65 */ 70 struct sockaddr_in6{ 71 /** Address family. 72 * Should be AF_INET6. 73 */ 66 struct sockaddr_in6 { 67 /** Address family. Should be AF_INET6. */ 74 68 uint16_t sin6_family; 75 /** Port number. 76 */ 69 /** Port number. */ 77 70 uint16_t sin6_port; 78 /** IPv6 flow information. 79 */ 71 /** IPv6 flow information. */ 80 72 uint32_t sin6_flowinfo; 81 /** IPv6 address. 82 */ 73 /** IPv6 address. */ 83 74 struct in6_addr sin6_addr; 84 /** Scope identifier. 85 */ 75 /** Scope identifier. */ 86 76 uint32_t sin6_scope_id; 87 77 }; -
uspace/lib/c/include/net/inet.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup icmp29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * I CMP module common interface.34 * Internet common definitions. 35 35 */ 36 36 37 #ifndef __NET_ICMP_COMMON_H__38 #define __NET_ICMP_COMMON_H__37 #ifndef LIBC_INET_H_ 38 #define LIBC_INET_H_ 39 39 40 #include <ipc/services.h> 40 #include <sys/types.h> 41 #include <byteorder.h> 41 42 42 #include <sys/time.h> 43 /** Type definition of the socket address. 44 * @see sockaddr 45 */ 46 typedef struct sockaddr sockaddr_t; 43 47 44 /** Default timeout for incoming connections in microseconds. 48 /** Type definition of the address information. 49 * @see addrinfo 45 50 */ 46 #define ICMP_CONNECT_TIMEOUT (1 * 1000 * 1000) 51 typedef struct addrinfo addrinfo_t; 47 52 48 /** Connects to the ICMP module. 49 * @param service The ICMP module service. Ignored parameter. 50 * @param[in] timeout The connection timeout in microseconds. No timeout if set to zero (0). 51 * @returns The ICMP module phone on success. 52 * @returns The ICMP socket identifier if called by the bundle module. 53 * @returns ETIMEOUT if the connection timeouted. 54 */ 55 extern int icmp_connect_module(services_t service, suseconds_t timeout); 53 /** Socket address. */ 54 struct sockaddr { 55 /** Address family. @see socket.h */ 56 uint16_t sa_family; 57 /** 14 byte protocol address. */ 58 uint8_t sa_data[14]; 59 }; 60 61 extern int inet_ntop(uint16_t, const uint8_t *, char *, size_t); 62 extern int inet_pton(uint16_t, const char *, uint8_t *); 56 63 57 64 #endif -
uspace/lib/c/include/net/packet_header.h
r9a1d8ab r0b749a3 27 27 */ 28 28 29 /** @addtogroup packet29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Packet header.34 * Packet header. 35 35 */ 36 36 37 #ifndef __NET_PACKET_HEADER_H__38 #define __NET_PACKET_HEADER_H__37 #ifndef LIBC_PACKET_HEADER_H_ 38 #define LIBC_PACKET_HEADER_H_ 39 39 40 #include < packet/packet.h>40 #include <net/packet.h> 41 41 42 42 /** Returns the actual packet data length. 43 * @param[in] headerThe packet header.43 * @param[in] header The packet header. 44 44 */ 45 #define PACKET_DATA_LENGTH(header) ((header)->data_end - (header)->data_start) 45 #define PACKET_DATA_LENGTH(header) \ 46 ((header)->data_end - (header)->data_start) 46 47 47 48 /** Returns the maximum packet address length. 48 * @param[in] headerThe packet header.49 * @param[in] header The packet header. 49 50 */ 50 #define PACKET_MAX_ADDRESS_LENGTH(header) ((header)->dest_addr - (header)->src_addr) 51 #define PACKET_MAX_ADDRESS_LENGTH(header) \ 52 ((header)->dest_addr - (header)->src_addr) 51 53 52 54 /** Returns the minimum packet suffix. 53 * @param[in] header The packet header.55 * @param[in] header The packet header. 54 56 */ 55 #define PACKET_MIN_SUFFIX(header) ((header)->length - (header)->data_start - (header)->max_content) 57 #define PACKET_MIN_SUFFIX(header) \ 58 ((header)->length - (header)->data_start - (header)->max_content) 56 59 57 /** Packet integrity check magic value. 58 */ 60 /** Packet integrity check magic value. */ 59 61 #define PACKET_MAGIC_VALUE 0x11227788 60 62 61 /** Packet header. 62 */ 63 struct packet{ 64 /** Packet identifier. 65 */ 63 /** Packet header. */ 64 struct packet { 65 /** Packet identifier. */ 66 66 packet_id_t packet_id; 67 /** Packet queue sorting value. 68 * The packet queue is sorted the ascending order. 67 68 /** 69 * Packet queue sorting value. 70 * The packet queue is sorted the ascending order. 69 71 */ 70 72 size_t order; 71 /** Packet metric. 72 */73 74 /** Packet metric. */ 73 75 size_t metric; 74 /** Previous packet in the queue. 75 */ 76 /** Previous packet in the queue. */ 76 77 packet_id_t previous; 77 /** Next packet in the queue. 78 */ 78 /** Next packet in the queue. */ 79 79 packet_id_t next; 80 /** Total length of the packet. 81 * Contains the header, the addresses and the data of the packet. 82 * Corresponds to the mapped sharable memory block. 80 81 /** 82 * Total length of the packet. 83 * Contains the header, the addresses and the data of the packet. 84 * Corresponds to the mapped sharable memory block. 83 85 */ 84 86 size_t length; 85 /** Stored source and destination addresses length. 86 */87 88 /** Stored source and destination addresses length. */ 87 89 size_t addr_len; 88 /** Souce address offset in bytes from the beginning of the packet header. 90 91 /** 92 * Souce address offset in bytes from the beginning of the packet 93 * header. 89 94 */ 90 95 size_t src_addr; 91 /** Destination address offset in bytes from the beginning of the packet header. 96 97 /** 98 * Destination address offset in bytes from the beginning of the packet 99 * header. 92 100 */ 93 101 size_t dest_addr; 94 /** Reserved data prefix length in bytes. 95 */102 103 /** Reserved data prefix length in bytes. */ 96 104 size_t max_prefix; 97 /** Reserved content length in bytes. 98 */ 105 /** Reserved content length in bytes. */ 99 106 size_t max_content; 100 /** Actual data start offset in bytes from the beginning of the packet header. 107 108 /** 109 * Actual data start offset in bytes from the beginning of the packet 110 * header. 101 111 */ 102 112 size_t data_start; 103 /** Actual data end offset in bytes from the beginning of the packet header. 113 114 /** 115 * Actual data end offset in bytes from the beginning of the packet 116 * header. 104 117 */ 105 118 size_t data_end; 106 /** Integrity check magic value. 107 */119 120 /** Integrity check magic value. */ 108 121 int magic_value; 109 122 }; 110 123 111 124 /** Returns whether the packet is valid. 112 * @param[in] packet The packet to be checked. 113 * @returns true if the packet is not NULL and the magic value is correct. 114 * @returns false otherwise. 125 * @param[in] packet The packet to be checked. 126 * @return True if the packet is not NULL and the magic value is 127 * correct. 128 * @return False otherwise. 115 129 */ 116 static inline int packet_is_valid(const packet_t packet){ 130 static inline int packet_is_valid(const packet_t *packet) 131 { 117 132 return packet && (packet->magic_value == PACKET_MAGIC_VALUE); 118 133 } -
uspace/lib/c/include/stdio.h
r9a1d8ab r0b749a3 46 46 #define BUFSIZ 4096 47 47 48 #define DEBUG(fmt, ...) se\48 #define DEBUG(fmt, ...) \ 49 49 { \ 50 50 char _buf[256]; \ -
uspace/lib/c/include/sys/stat.h
r9a1d8ab r0b749a3 43 43 struct stat { 44 44 fs_handle_t fs_handle; 45 dev _handle_t dev_handle;45 devmap_handle_t devmap_handle; 46 46 fs_index_t index; 47 47 unsigned int lnkcnt; … … 49 49 bool is_directory; 50 50 aoff64_t size; 51 dev _handle_t device;51 devmap_handle_t device; 52 52 }; 53 53 -
uspace/lib/c/include/sys/time.h
r9a1d8ab r0b749a3 43 43 typedef long suseconds_t; 44 44 45 typedef uint32_t useconds_t; 46 typedef uint32_t mseconds_t; 47 45 48 struct timeval { 46 49 time_t tv_sec; /* seconds */ -
uspace/lib/c/include/task.h
r9a1d8ab r0b749a3 48 48 extern int task_set_name(const char *); 49 49 extern task_id_t task_spawn(const char *, const char *const[], int *); 50 extern int task_spawnv(task_id_t *, const char *path, const char *const []); 51 extern int task_spawnl(task_id_t *, const char *path, ...); 52 50 53 extern int task_wait(task_id_t id, task_exit_t *, int *); 51 54 extern int task_retval(int); -
uspace/lib/c/include/unistd.h
r9a1d8ab r0b749a3 37 37 38 38 #include <sys/types.h> 39 #include <time.h> 39 40 #include <libarch/config.h> 40 41 41 42 #ifndef NULL 42 #define NULL 043 #define NULL ((void *) 0) 43 44 #endif 44 45 … … 56 57 #define SEEK_END 2 57 58 #endif 58 59 typedef uint32_t useconds_t;60 59 61 60 extern int dup2(int oldfd, int newfd); -
uspace/lib/c/include/vfs/vfs.h
r9a1d8ab r0b749a3 47 47 typedef struct { 48 48 fs_handle_t fs_handle; 49 dev _handle_t dev_handle;49 devmap_handle_t devmap_handle; 50 50 fs_index_t index; 51 51 } fdi_node_t;
Note:
See TracChangeset
for help on using the changeset viewer.
