Changeset 98abd40 in mainline for uspace/lib/c/include
- Timestamp:
- 2013-07-06T21:57:22Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c8bb1633, cdc8a391
- Parents:
- b8e72fd1 (diff), 507c6f3 (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:
-
- 2 added
- 16 edited
-
bd_srv.h (modified) (2 diffs)
-
cc.h (added)
-
inet/addr.h (modified) (1 diff)
-
inet/dnsr.h (modified) (1 diff)
-
inet/inetping.h (modified) (2 diffs)
-
inet/inetping6.h (added)
-
inet/iplink.h (modified) (4 diffs)
-
inet/iplink_srv.h (modified) (3 diffs)
-
io/con_srv.h (modified) (2 diffs)
-
ipc/inet.h (modified) (2 diffs)
-
ipc/services.h (modified) (1 diff)
-
mem.h (modified) (1 diff)
-
net/in.h (modified) (2 diffs)
-
net/in6.h (modified) (2 diffs)
-
net/inet.h (modified) (1 diff)
-
net/ip_protocols.h (modified) (1 diff)
-
net/socket_codes.h (modified) (2 diffs)
-
str.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/bd_srv.h
rb8e72fd1 r98abd40 57 57 } bd_srv_t; 58 58 59 typedefstruct bd_ops {59 struct bd_ops { 60 60 int (*open)(bd_srvs_t *, bd_srv_t *); 61 61 int (*close)(bd_srv_t *); … … 65 65 int (*get_block_size)(bd_srv_t *, size_t *); 66 66 int (*get_num_blocks)(bd_srv_t *, aoff64_t *); 67 } bd_ops_t;67 }; 68 68 69 69 extern void bd_srvs_init(bd_srvs_t *); -
uspace/lib/c/include/inet/addr.h
rb8e72fd1 r98abd40 37 37 38 38 #include <stdint.h> 39 #include <net/in.h> 40 #include <net/in6.h> 41 42 typedef uint32_t addr32_t; 43 typedef uint8_t addr48_t[6]; 44 typedef uint8_t addr128_t[16]; 39 45 40 46 /** Node address */ 41 47 typedef struct { 42 uint32_t ipv4; 48 uint16_t family; 49 union { 50 addr32_t addr; 51 addr128_t addr6; 52 }; 43 53 } inet_addr_t; 44 54 45 55 /** Network address */ 46 56 typedef struct { 57 /** Address family */ 58 uint16_t family; 59 47 60 /** Address */ 48 uint32_t ipv4; 49 /** Number of valid bits in @c ipv4 */ 50 int bits; 61 union { 62 addr32_t addr; 63 addr128_t addr6; 64 }; 65 66 /** Number of valid bits */ 67 uint8_t prefix; 51 68 } inet_naddr_t; 52 69 70 extern const addr48_t addr48_broadcast; 71 72 extern void addr48(const addr48_t, addr48_t); 73 extern void addr128(const addr128_t, addr128_t); 74 75 extern void host2addr128_t_be(const addr128_t, addr128_t); 76 extern void addr128_t_be2host(const addr128_t, addr128_t); 77 78 extern void inet_addr(inet_addr_t *, uint8_t, uint8_t, uint8_t, uint8_t); 79 extern void inet_naddr(inet_naddr_t *, uint8_t, uint8_t, uint8_t, uint8_t, 80 uint8_t); 81 82 extern void inet_addr6(inet_addr_t *, uint16_t, uint16_t, uint16_t, uint16_t, 83 uint16_t, uint16_t, uint16_t, uint16_t); 84 extern void inet_naddr6(inet_naddr_t *, uint16_t, uint16_t, uint16_t, uint16_t, 85 uint16_t, uint16_t, uint16_t, uint16_t, uint8_t); 86 87 extern int inet_addr_family(const char *, uint16_t *); 88 extern void inet_naddr_addr(const inet_naddr_t *, inet_addr_t *); 89 90 extern void inet_addr_any(inet_addr_t *); 91 extern void inet_naddr_any(inet_naddr_t *); 92 93 extern int inet_addr_compare(const inet_addr_t *, const inet_addr_t *); 94 extern int inet_addr_is_any(const inet_addr_t *); 95 96 extern int inet_naddr_compare_mask(const inet_naddr_t *, const inet_addr_t *); 97 98 extern int inet_addr_parse(const char *, inet_addr_t *); 53 99 extern int inet_naddr_parse(const char *, inet_naddr_t *); 54 extern int inet_addr_parse(const char *, inet_addr_t *); 55 extern int inet_naddr_format(inet_naddr_t *, char **); 56 extern int inet_addr_format(inet_addr_t *, char **); 100 101 extern int inet_addr_format(const inet_addr_t *, char **); 102 extern int inet_naddr_format(const inet_naddr_t *, char **); 103 104 extern uint16_t inet_addr_get(const inet_addr_t *, addr32_t *, addr128_t *); 105 extern uint16_t inet_naddr_get(const inet_naddr_t *, addr32_t *, addr128_t *, 106 uint8_t *); 107 108 extern void inet_addr_set(addr32_t, inet_addr_t *); 109 extern void inet_naddr_set(addr32_t, uint8_t, inet_naddr_t *); 110 extern void inet_sockaddr_in_addr(const sockaddr_in_t *, inet_addr_t *); 111 112 extern void inet_addr_set6(addr128_t, inet_addr_t *); 113 extern void inet_naddr_set6(addr128_t, uint8_t, inet_naddr_t *); 114 extern void inet_sockaddr_in6_addr(const sockaddr_in6_t *, inet_addr_t *); 115 116 extern uint16_t inet_addr_sockaddr_in(const inet_addr_t *, sockaddr_in_t *, 117 sockaddr_in6_t *); 57 118 58 119 #endif -
uspace/lib/c/include/inet/dnsr.h
rb8e72fd1 r98abd40 37 37 38 38 #include <inet/inet.h> 39 #include <inet/addr.h> 39 40 40 41 enum { -
uspace/lib/c/include/inet/inetping.h
rb8e72fd1 r98abd40 40 40 41 41 typedef struct { 42 inet_addr_t src;43 inet_addr_t dest;42 uint32_t src; 43 uint32_t dest; 44 44 uint16_t seq_no; 45 45 void *data; … … 53 53 extern int inetping_init(inetping_ev_ops_t *); 54 54 extern int inetping_send(inetping_sdu_t *); 55 extern int inetping_get_srcaddr(inet_addr_t *, inet_addr_t *); 56 55 extern int inetping_get_srcaddr(uint32_t, uint32_t *); 57 56 58 57 #endif -
uspace/lib/c/include/inet/iplink.h
rb8e72fd1 r98abd40 38 38 #include <async.h> 39 39 #include <sys/types.h> 40 #include <inet/addr.h> 40 41 41 42 struct iplink_ev_ops; … … 46 47 } iplink_t; 47 48 48 typedef struct { 49 uint32_t ipv4; 50 } iplink_addr_t; 51 52 /** IP link Service Data Unit */ 49 /** Internet link Service Data Unit */ 53 50 typedef struct { 54 51 /** Local source address */ 55 i plink_addr_t lsrc;52 inet_addr_t src; 56 53 /** Local destination address */ 57 i plink_addr_t ldest;54 inet_addr_t dest; 58 55 /** Serialized IP packet */ 59 56 void *data; … … 62 59 } iplink_sdu_t; 63 60 61 /** Internet link receive Service Data Unit */ 62 typedef struct { 63 /** Serialized datagram */ 64 void *data; 65 /** Size of @c data in bytes */ 66 size_t size; 67 } iplink_recv_sdu_t; 68 64 69 typedef struct iplink_ev_ops { 65 int (*recv)(iplink_t *, iplink_ sdu_t *);70 int (*recv)(iplink_t *, iplink_recv_sdu_t *, uint16_t); 66 71 } iplink_ev_ops_t; 67 72 … … 69 74 extern void iplink_close(iplink_t *); 70 75 extern int iplink_send(iplink_t *, iplink_sdu_t *); 71 extern int iplink_addr_add(iplink_t *, i plink_addr_t *);72 extern int iplink_addr_remove(iplink_t *, i plink_addr_t *);76 extern int iplink_addr_add(iplink_t *, inet_addr_t *); 77 extern int iplink_addr_remove(iplink_t *, inet_addr_t *); 73 78 extern int iplink_get_mtu(iplink_t *, size_t *); 74 79 -
uspace/lib/c/include/inet/iplink_srv.h
rb8e72fd1 r98abd40 40 40 #include <stdbool.h> 41 41 #include <sys/types.h> 42 #include <inet/addr.h> 43 #include <inet/iplink.h> 42 44 43 45 struct iplink_ops; … … 51 53 } iplink_srv_t; 52 54 53 typedef struct {54 uint32_t ipv4;55 } iplink_srv_addr_t;56 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;68 69 55 typedef struct iplink_ops { 70 56 int (*open)(iplink_srv_t *); 71 57 int (*close)(iplink_srv_t *); 72 int (*send)(iplink_srv_t *, iplink_s rv_sdu_t *);58 int (*send)(iplink_srv_t *, iplink_sdu_t *); 73 59 int (*get_mtu)(iplink_srv_t *, size_t *); 74 int (*addr_add)(iplink_srv_t *, i plink_srv_addr_t *);75 int (*addr_remove)(iplink_srv_t *, i plink_srv_addr_t *);60 int (*addr_add)(iplink_srv_t *, inet_addr_t *); 61 int (*addr_remove)(iplink_srv_t *, inet_addr_t *); 76 62 } iplink_ops_t; 77 63 … … 79 65 80 66 extern int iplink_conn(ipc_callid_t, ipc_call_t *, void *); 81 extern int iplink_ev_recv(iplink_srv_t *, iplink_ srv_sdu_t *);67 extern int iplink_ev_recv(iplink_srv_t *, iplink_recv_sdu_t *, uint16_t); 82 68 83 69 #endif -
uspace/lib/c/include/io/con_srv.h
rb8e72fd1 r98abd40 66 66 } con_srv_t; 67 67 68 typedefstruct con_ops {68 struct con_ops { 69 69 int (*open)(con_srvs_t *, con_srv_t *); 70 70 int (*close)(con_srv_t *); … … 83 83 void (*set_cursor_visibility)(con_srv_t *, bool); 84 84 int (*get_event)(con_srv_t *, cons_event_t *); 85 } con_ops_t;85 }; 86 86 87 87 extern void con_srvs_init(con_srvs_t *); -
uspace/lib/c/include/ipc/inet.h
rb8e72fd1 r98abd40 45 45 INET_PORT_CFG, 46 46 /** Ping service port */ 47 INET_PORT_PING 47 INET_PORT_PING, 48 /** Ping6 service port */ 49 INET_PORT_PING6 48 50 } inet_port_t; 49 51 … … 88 90 } inetping_request_t; 89 91 92 /** Events on Inet ping6 port */ 93 typedef enum { 94 INETPING6_EV_RECV = IPC_FIRST_USER_METHOD 95 } inetping6_event_t; 96 97 /** Requests on Inet ping6 port */ 98 typedef enum { 99 INETPING6_SEND = IPC_FIRST_USER_METHOD, 100 INETPING6_GET_SRCADDR 101 } inetping6_request_t; 102 90 103 #endif 91 104 -
uspace/lib/c/include/ipc/services.h
rb8e72fd1 r98abd40 53 53 } services_t; 54 54 55 #define SERVICE_NAME_DNSR "net/dnsr" 56 #define SERVICE_NAME_INET "net/inet" 57 #define SERVICE_NAME_INETCFG "net/inetcfg" 58 #define SERVICE_NAME_INETPING "net/inetping" 55 #define SERVICE_NAME_DNSR "net/dnsr" 56 #define SERVICE_NAME_INET "net/inet" 57 #define SERVICE_NAME_INETCFG "net/inetcfg" 58 #define SERVICE_NAME_INETPING "net/inetping" 59 #define SERVICE_NAME_INETPING6 "net/inetping6" 59 60 60 61 #endif -
uspace/lib/c/include/mem.h
rb8e72fd1 r98abd40 37 37 38 38 #include <sys/types.h> 39 #include <cc.h> 39 40 40 41 extern void *memset(void *, int, size_t) 41 __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));42 ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns"); 42 43 extern void *memcpy(void *, const void *, size_t) 43 __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));44 ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns"); 44 45 extern void *memmove(void *, const void *, size_t); 45 46 extern int memcmp(const void *, const void *, size_t); -
uspace/lib/c/include/net/in.h
rb8e72fd1 r98abd40 45 45 #define INET_ADDRSTRLEN (4 * 3 + 3 + 1) 46 46 47 #define INADDR_ANY 0 48 49 /** Type definition of the INET address. 50 * @see in_addr 51 */ 52 typedef struct in_addr in_addr_t; 53 54 /** Type definition of the INET socket address. 55 * @see sockaddr_in 56 */ 57 typedef struct sockaddr_in sockaddr_in_t; 47 #define INADDR_ANY 0 58 48 59 49 /** INET address. */ 60 struct in_addr {50 typedef struct in_addr { 61 51 /** 4 byte IP address. */ 62 52 uint32_t s_addr; 63 } ;53 } in_addr_t; 64 54 65 55 /** INET socket address. 66 56 * @see sockaddr 67 57 */ 68 struct sockaddr_in {58 typedef struct sockaddr_in { 69 59 /** Address family. Should be AF_INET. */ 70 60 uint16_t sin_family; … … 72 62 uint16_t sin_port; 73 63 /** Internet address. */ 74 struct in_addrsin_addr;64 in_addr_t sin_addr; 75 65 /** Padding to meet the sockaddr size. */ 76 66 uint8_t sin_zero[8]; 77 } ;67 } sockaddr_in_t; 78 68 79 69 #endif -
uspace/lib/c/include/net/in6.h
rb8e72fd1 r98abd40 43 43 44 44 /** INET6 string address maximum length. */ 45 #define INET6_ADDRSTRLEN (8 * 4 + 7 + 1) 46 47 /** Type definition of the INET6 address. 48 * @see in6_addr 49 */ 50 typedef struct in6_addr in6_addr_t; 51 52 /** Type definition of the INET6 socket address. 53 * @see sockaddr_in6 54 */ 55 typedef struct sockaddr_in6 sockaddr_in6_t; 45 #define INET6_ADDRSTRLEN (8 * 4 + 7 + 1) 56 46 57 47 /** INET6 address. */ 58 struct in6_addr {48 typedef struct in6_addr { 59 49 /** 16 byte IPv6 address. */ 60 u nsigned chars6_addr[16];61 } ;50 uint8_t s6_addr[16]; 51 } in6_addr_t; 62 52 63 53 /** INET6 socket address. 64 54 * @see sockaddr 65 55 */ 66 struct sockaddr_in6 {56 typedef struct sockaddr_in6 { 67 57 /** Address family. Should be AF_INET6. */ 68 58 uint16_t sin6_family; … … 75 65 /** Scope identifier. */ 76 66 uint32_t sin6_scope_id; 77 }; 67 } sockaddr_in6_t; 68 69 extern const in6_addr_t in6addr_any; 78 70 79 71 #endif -
uspace/lib/c/include/net/inet.h
rb8e72fd1 r98abd40 41 41 #include <byteorder.h> 42 42 43 /** Type definition of the socket address.44 * @see sockaddr45 */46 typedef struct sockaddr sockaddr_t;47 48 43 /** Type definition of the address information. 49 44 * @see addrinfo 50 45 */ 51 typedef struct addrinfo addrinfo_t;46 typedef struct addrinfo addrinfo_t; 52 47 53 48 /** Socket address. */ 54 struct sockaddr {49 typedef struct sockaddr { 55 50 /** Address family. @see socket.h */ 56 51 uint16_t sa_family; 57 52 /** 14 byte protocol address. */ 58 53 uint8_t sa_data[14]; 59 } ;54 } sockaddr_t; 60 55 61 56 extern int inet_ntop(uint16_t, const uint8_t *, char *, size_t); -
uspace/lib/c/include/net/ip_protocols.h
rb8e72fd1 r98abd40 44 44 /*@{*/ 45 45 46 #define IPPROTO_ICMP 1 47 #define IPPROTO_TCP 6 48 #define IPPROTO_UDP 17 46 #define IPPROTO_ICMP 1 47 #define IPPROTO_TCP 6 48 #define IPPROTO_UDP 17 49 #define IPPROTO_ICMPV6 58 49 50 50 51 /*@}*/ -
uspace/lib/c/include/net/socket_codes.h
rb8e72fd1 r98abd40 45 45 46 46 enum { 47 AF_ UNKNOWN= 0,48 AF_INET, /* IPv4 address */49 AF_INET6 /* IPv6 address */47 AF_NONE = 0, 48 AF_INET, /* IPv4 address */ 49 AF_INET6 /* IPv6 address */ 50 50 }; 51 51 … … 53 53 54 54 /** @name Protocol families definitions 55 * Same as address families.55 * Same as address families. 56 56 */ 57 57 /*@{*/ 58 58 59 #define PF_INET AF_INET60 #define PF_INET6 AF_INET659 #define PF_INET AF_INET 60 #define PF_INET6 AF_INET6 61 61 62 62 /*@}*/ -
uspace/lib/c/include/str.h
rb8e72fd1 r98abd40 109 109 extern char *str_ndup(const char *, size_t max_size); 110 110 111 extern int str_uint8_t(const char *, char **, unsigned int, bool, uint8_t *); 112 extern int str_uint16_t(const char *, char **, unsigned int, bool, uint16_t *); 113 extern int str_uint32_t(const char *, char **, unsigned int, bool, uint32_t *); 114 extern int str_uint64_t(const char *, char **, unsigned int, bool, uint64_t *); 115 extern int str_size_t(const char *, char **, unsigned int, bool, size_t *); 111 extern int str_uint8_t(const char *, const char **, unsigned int, bool, 112 uint8_t *); 113 extern int str_uint16_t(const char *, const char **, unsigned int, bool, 114 uint16_t *); 115 extern int str_uint32_t(const char *, const char **, unsigned int, bool, 116 uint32_t *); 117 extern int str_uint64_t(const char *, const char **, unsigned int, bool, 118 uint64_t *); 119 extern int str_size_t(const char *, const char **, unsigned int, bool, 120 size_t *); 116 121 117 122 extern void order_suffix(const uint64_t, uint64_t *, char *);
Note:
See TracChangeset
for help on using the changeset viewer.
