Changeset a7a7f8c in mainline for uspace/lib/c/include
- Timestamp:
- 2012-04-20T07:32:57Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 097f421
- Parents:
- 90f067d9 (diff), 606c369 (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:
-
- 1 added
- 11 deleted
- 4 edited
- 6 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/async.h
r90f067d9 ra7a7f8c 139 139 extern void async_wait_for(aid_t, sysarg_t *); 140 140 extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t); 141 extern void async_forget(aid_t); 141 142 142 143 extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t, -
uspace/lib/c/include/inet/inet.h
r90f067d9 ra7a7f8c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup lib net29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 33 32 /** @file 34 * Hardware types according to the on-line IANA - Address Resolution Protocol35 * (ARP) Parameters36 * http://www.iana.org/assignments/arp-parameters/arp-parameters.xml,37 * cited January 14 2009.38 33 */ 39 34 40 #ifndef LIB NET_NET_HARDWARE_H_41 #define LIB NET_NET_HARDWARE_H_35 #ifndef LIBC_INET_INET_H_ 36 #define LIBC_INET_INET_H_ 42 37 43 38 #include <sys/types.h> 44 39 45 /** Network interface layer type type definition. */ 46 typedef uint8_t hw_type_t; 40 #define INET_TTL_MAX 255 47 41 48 /** @name Network interface layer types definitions */ 49 /*@{*/ 42 typedef struct { 43 uint32_t ipv4; 44 } inet_addr_t; 50 45 51 /** Ethernet (10Mb) hardware type. */ 52 #define HW_ETHER 1 46 typedef struct { 47 inet_addr_t src; 48 inet_addr_t dest; 49 uint8_t tos; 50 void *data; 51 size_t size; 52 } inet_dgram_t; 53 53 54 /*@}*/ 54 typedef struct { 55 int (*recv)(inet_dgram_t *); 56 } inet_ev_ops_t; 57 58 typedef enum { 59 INET_DF = 1 60 } inet_df_t; 61 62 extern int inet_init(uint8_t, inet_ev_ops_t *); 63 extern int inet_send(inet_dgram_t *, uint8_t, inet_df_t); 64 extern int inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *); 55 65 56 66 #endif … … 58 68 /** @} 59 69 */ 60 -
uspace/lib/c/include/inet/inetping.h
r90f067d9 ra7a7f8c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 28 28 29 29 /** @addtogroup libc 30 * @{ 30 * @{ 31 */ 32 /** @file 31 33 */ 32 34 33 /** @file 34 * ICMP common interface implementation. 35 * @see icmp_common.h 36 */ 35 #ifndef LIBC_INET_INETPING_H_ 36 #define LIBC_INET_INETPING_H_ 37 37 38 #include <net/modules.h> 39 #include <net/icmp_common.h> 40 #include <ipc/services.h> 41 #include <ipc/icmp.h> 42 #include <sys/time.h> 43 #include <async.h> 38 #include <inet/inet.h> 39 #include <sys/types.h> 44 40 45 /** Connect to the ICMP module. 46 * 47 * @return ICMP module session. 48 * 49 */ 50 async_sess_t *icmp_connect_module(void) 51 { 52 return connect_to_service(SERVICE_ICMP); 53 } 41 typedef struct { 42 inet_addr_t src; 43 inet_addr_t dest; 44 uint16_t seq_no; 45 void *data; 46 size_t size; 47 } inetping_sdu_t; 48 49 typedef struct inetping_ev_ops { 50 int (*recv)(inetping_sdu_t *); 51 } inetping_ev_ops_t; 52 53 extern int inetping_init(inetping_ev_ops_t *); 54 extern int inetping_send(inetping_sdu_t *); 55 extern int inetping_get_srcaddr(inet_addr_t *, inet_addr_t *); 56 57 58 #endif 54 59 55 60 /** @} -
uspace/lib/c/include/inet/iplink.h
r90f067d9 ra7a7f8c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup lib net29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 33 32 /** @file 34 * Internetwork layer module interface for the underlying network interface35 * layer. This interface is always called by the remote modules.36 33 */ 37 34 38 #ifndef LIB NET_IL_REMOTE_H_39 #define LIB NET_IL_REMOTE_H_35 #ifndef LIBC_INET_IPLINK_H_ 36 #define LIBC_INET_IPLINK_H_ 40 37 41 #include < ipc/services.h>38 #include <async.h> 42 39 #include <sys/types.h> 43 #include <net/device.h>44 #include <net/packet.h>45 #include <async.h>46 40 47 /** @name Internetwork layer module interface 48 * This interface is used by other modules. 49 */ 50 /*@{*/ 41 struct iplink_ev_ops; 51 42 52 extern int il_device_state_msg(async_sess_t *, nic_device_id_t, 53 nic_device_state_t, services_t); 54 extern int il_received_msg(async_sess_t *, nic_device_id_t, packet_t *, 55 services_t); 56 extern int il_mtu_changed_msg(async_sess_t *, nic_device_id_t, size_t, 57 services_t); 58 extern int il_addr_changed_msg(async_sess_t *, nic_device_id_t, size_t, 59 const uint8_t *); 43 typedef struct { 44 async_sess_t *sess; 45 struct iplink_ev_ops *ev_ops; 46 } iplink_t; 60 47 61 /*@}*/ 48 typedef struct { 49 uint32_t ipv4; 50 } iplink_addr_t; 51 52 /** IP link Service Data Unit */ 53 typedef struct { 54 /** Local source address */ 55 iplink_addr_t lsrc; 56 /** Local destination address */ 57 iplink_addr_t ldest; 58 /** Serialized IP packet */ 59 void *data; 60 /** Size of @c data in bytes */ 61 size_t size; 62 } iplink_sdu_t; 63 64 typedef struct iplink_ev_ops { 65 int (*recv)(iplink_t *, iplink_sdu_t *); 66 } iplink_ev_ops_t; 67 68 extern int iplink_open(async_sess_t *, iplink_ev_ops_t *, iplink_t **); 69 extern void iplink_close(iplink_t *); 70 extern int iplink_send(iplink_t *, iplink_sdu_t *); 71 extern int iplink_addr_add(iplink_t *, iplink_addr_t *); 72 extern int iplink_addr_remove(iplink_t *, iplink_addr_t *); 73 extern int iplink_get_mtu(iplink_t *, size_t *); 62 74 63 75 #endif -
uspace/lib/c/include/inet/iplink_srv.h
r90f067d9 ra7a7f8c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 28 28 29 29 /** @addtogroup libc 30 * @{ 30 * @{ 31 */ 32 /** @file 31 33 */ 32 34 33 /** @file 34 * Character string with measured length. 35 * The structure has been designed for serialization of character strings 36 * between modules. 37 */ 35 #ifndef LIBC_INET_IPLINK_SRV_H_ 36 #define LIBC_INET_IPLINK_SRV_H_ 38 37 39 #ifndef LIBC_MEASURED_STRINGS_H_ 40 #define LIBC_MEASURED_STRINGS_H_ 38 #include <async.h> 39 #include <fibril_synch.h> 40 #include <bool.h> 41 #include <sys/types.h> 41 42 42 #include <sys/types.h> 43 #include <async.h> 43 struct iplink_ops; 44 44 45 /** Type definition of the character string with measured length. 46 * @see measured_string 47 */ 48 typedef struct measured_string measured_string_t; 45 typedef struct { 46 fibril_mutex_t lock; 47 bool connected; 48 struct iplink_ops *ops; 49 void *arg; 50 async_sess_t *client_sess; 51 } iplink_srv_t; 49 52 50 /** Character string with measured length. 51 * 52 * This structure has been designed for serialization of character strings 53 * between modules. 54 */ 55 struct measured_string { 56 /** Character string data. */ 57 uint8_t *value; 58 /** Character string length. */ 59 size_t length; 60 }; 53 typedef struct { 54 uint32_t ipv4; 55 } iplink_srv_addr_t; 61 56 62 extern measured_string_t *measured_string_create_bulk(const uint8_t *, size_t); 63 extern measured_string_t *measured_string_copy(measured_string_t *); 57 /** IP link Service Data Unit */ 58 typedef struct { 59 /** Local source address */ 60 iplink_srv_addr_t lsrc; 61 /** Local destination address */ 62 iplink_srv_addr_t ldest; 63 /** Serialized IP packet */ 64 void *data; 65 /** Size of @c data in bytes */ 66 size_t size; 67 } iplink_srv_sdu_t; 64 68 65 extern int measured_strings_receive(measured_string_t **, uint8_t **, size_t); 66 extern int measured_strings_reply(const measured_string_t *, size_t); 69 typedef struct iplink_ops { 70 int (*open)(iplink_srv_t *); 71 int (*close)(iplink_srv_t *); 72 int (*send)(iplink_srv_t *, iplink_srv_sdu_t *); 73 int (*get_mtu)(iplink_srv_t *, size_t *); 74 int (*addr_add)(iplink_srv_t *, iplink_srv_addr_t *); 75 int (*addr_remove)(iplink_srv_t *, iplink_srv_addr_t *); 76 } iplink_ops_t; 67 77 68 extern int measured_strings_return(async_exch_t *, measured_string_t **,69 uint8_t **, size_t); 70 extern int measured_strings_send(async_exch_t *, const measured_string_t *,71 size_t);78 extern void iplink_srv_init(iplink_srv_t *); 79 80 extern int iplink_conn(ipc_callid_t, ipc_call_t *, void *); 81 extern int iplink_ev_recv(iplink_srv_t *, iplink_srv_sdu_t *); 72 82 73 83 #endif -
uspace/lib/c/include/ipc/inet.h
r90f067d9 ra7a7f8c 1 1 /* 2 * Copyright (c) 2009 Lukas Mejdrech 3 * Copyright (c) 2011 Radim Vansa 2 * Copyright (c) 2012 Jiri Svoboda 4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @addtogroup lib packet29 /** @addtogroup libcipc 31 30 * @{ 32 31 */ 33 34 32 /** @file 35 * Packet server.36 * The hosting module has to be compiled with both the packet.c and the37 * packet_server.c source files. To function correctly, initialization of the38 * packet map by the pm_init() function has to happen at the first place. Then39 * the packet messages have to be processed by the packet_server_message()40 * function. The packet map should be released by the pm_destroy() function41 * during the module termination.42 * @see IS_NET_PACKET_MESSAGE()43 33 */ 44 34 45 #ifndef NET_PACKET_SERVER_H_46 #define NET_PACKET_SERVER_H_35 #ifndef LIBC_IPC_INET_H_ 36 #define LIBC_IPC_INET_H_ 47 37 48 38 #include <ipc/common.h> 49 39 50 extern int packet_server_init(void); 51 extern int packet_server_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, 52 size_t *); 40 /** Inet ports */ 41 typedef enum { 42 /** Default port */ 43 INET_PORT_DEFAULT = 1, 44 /** Configuration port */ 45 INET_PORT_CFG, 46 /** Ping service port */ 47 INET_PORT_PING 48 } inet_port_t; 49 50 /** Requests on Inet default port */ 51 typedef enum { 52 INET_CALLBACK_CREATE = IPC_FIRST_USER_METHOD, 53 INET_GET_SRCADDR, 54 INET_SEND, 55 INET_SET_PROTO 56 } inet_request_t; 57 58 /** Events on Inet default port */ 59 typedef enum { 60 INET_EV_RECV = IPC_FIRST_USER_METHOD 61 } inet_event_t; 62 63 /** Requests on Inet configuration port */ 64 typedef enum { 65 INETCFG_ADDR_CREATE_STATIC = IPC_FIRST_USER_METHOD, 66 INETCFG_ADDR_DELETE, 67 INETCFG_ADDR_GET, 68 INETCFG_ADDR_GET_ID, 69 INETCFG_GET_ADDR_LIST, 70 INETCFG_GET_LINK_LIST, 71 INETCFG_GET_SROUTE_LIST, 72 INETCFG_LINK_GET, 73 INETCFG_SROUTE_CREATE, 74 INETCFG_SROUTE_DELETE, 75 INETCFG_SROUTE_GET, 76 INETCFG_SROUTE_GET_ID 77 } inetcfg_request_t; 78 79 /** Events on Inet ping port */ 80 typedef enum { 81 INETPING_EV_RECV = IPC_FIRST_USER_METHOD 82 } inetping_event_t; 83 84 /** Requests on Inet ping port */ 85 typedef enum { 86 INETPING_SEND = IPC_FIRST_USER_METHOD, 87 INETPING_GET_SRCADDR 88 } inetping_request_t; 53 89 54 90 #endif 55 91 56 /** @} 92 /** 93 * @} 57 94 */ -
uspace/lib/c/include/ipc/iplink.h
r90f067d9 ra7a7f8c 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libc 29 /** @addtogroup libcipc 30 30 * @{ 31 31 */ 32 33 32 /** @file 34 * Transport layer modules messages.35 * @see tl_interface.h36 33 */ 37 34 38 #ifndef LIBC_ TL_MESSAGES_H_39 #define LIBC_ TL_MESSAGES_H_35 #ifndef LIBC_IPC_IPLINK_H_ 36 #define LIBC_IPC_IPLINK_H_ 40 37 41 #include <ipc/ net.h>38 #include <ipc/common.h> 42 39 43 /** Transport layer modules messages. */44 40 typedef enum { 45 /** Packet received message. 46 * @see tl_received_msg() 47 */ 48 NET_TL_RECEIVED = NET_TL_FIRST 49 } tl_messages; 41 IPLINK_GET_MTU = IPC_FIRST_USER_METHOD, 42 IPLINK_SEND, 43 IPLINK_ADDR_ADD, 44 IPLINK_ADDR_REMOVE 45 } iplink_request_t; 46 47 typedef enum { 48 IPLINK_EV_RECV = IPC_FIRST_USER_METHOD 49 } iplink_event_t; 50 50 51 51 #endif 52 52 53 /** @} 53 /** 54 * @} 54 55 */ -
uspace/lib/c/include/ipc/services.h
r90f067d9 ra7a7f8c 48 48 SERVICE_IRC = FOURCC('i', 'r', 'c', ' '), 49 49 SERVICE_CLIPBOARD = FOURCC('c', 'l', 'i', 'p'), 50 SERVICE_NETWORKING = FOURCC('n', 'e', 't', ' '),51 SERVICE_ETHERNET = FOURCC('e', 't', 'h', ' '),52 SERVICE_NILDUMMY = FOURCC('n', 'i', 'l', 'd'),53 SERVICE_IP = FOURCC('i', 'p', 'v', '4'),54 SERVICE_ARP = FOURCC('a', 'r', 'p', ' '),55 SERVICE_ICMP = FOURCC('i', 'c', 'm', 'p'),56 50 SERVICE_UDP = FOURCC('u', 'd', 'p', ' '), 57 51 SERVICE_TCP = FOURCC('t', 'c', 'p', ' ') 58 52 } services_t; 53 54 #define SERVICE_NAME_INET "net/inet" 55 #define SERVICE_NAME_INETCFG "net/inetcfg" 56 #define SERVICE_NAME_INETPING "net/inetping" 59 57 60 58 #endif -
uspace/lib/c/include/ipc/socket.h
r90f067d9 ra7a7f8c 38 38 #define LIBC_SOCKET_MESSAGES_H_ 39 39 40 #include <ipc/net.h>41 42 40 /** Socket client messages. */ 43 41 typedef enum { 44 42 /** Creates a new socket. @see socket() */ 45 NET_SOCKET = NET_SOCKET_FIRST,43 NET_SOCKET = IPC_FIRST_USER_METHOD, 46 44 /** Binds the socket. @see bind() */ 47 45 NET_SOCKET_BIND, -
uspace/lib/c/include/net/in.h
r90f067d9 ra7a7f8c 45 45 #define INET_ADDRSTRLEN (4 * 3 + 3 + 1) 46 46 47 #define INADDR_ANY 0 48 47 49 /** Type definition of the INET address. 48 50 * @see in_addr
Note:
See TracChangeset
for help on using the changeset viewer.