Changeset 03c971f in mainline for uspace/lib/c/include
- Timestamp:
- 2013-08-15T14:20:16Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bb2a5b2
- Parents:
- f2c19b0 (diff), 2921602 (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
- 20 edited
-
bd_srv.h (modified) (2 diffs)
-
bitops.h (modified) (1 diff)
-
cc.h (added)
-
inet/addr.h (modified) (1 diff)
-
inet/dnsr.h (modified) (2 diffs)
-
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)
-
io/verify.h (modified) (1 diff)
-
ipc/inet.h (modified) (2 diffs)
-
ipc/iplink.h (modified) (1 diff)
-
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)
-
stdio.h (modified) (1 diff)
-
str.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/bd_srv.h
rf2c19b0 r03c971f 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/bitops.h
rf2c19b0 r03c971f 107 107 } 108 108 109 extern int __popcountsi2(int); 110 109 111 #endif 110 112 -
uspace/lib/c/include/inet/addr.h
rf2c19b0 r03c971f 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 int addr48_compare(const addr48_t, const addr48_t); 76 extern int addr128_compare(const addr128_t, const addr128_t); 77 78 extern void addr48_solicited_node(const addr128_t, addr48_t); 79 80 extern void host2addr128_t_be(const addr128_t, addr128_t); 81 extern void addr128_t_be2host(const addr128_t, addr128_t); 82 83 extern void inet_addr(inet_addr_t *, uint8_t, uint8_t, uint8_t, uint8_t); 84 extern void inet_naddr(inet_naddr_t *, uint8_t, uint8_t, uint8_t, uint8_t, 85 uint8_t); 86 87 extern void inet_addr6(inet_addr_t *, uint16_t, uint16_t, uint16_t, uint16_t, 88 uint16_t, uint16_t, uint16_t, uint16_t); 89 extern void inet_naddr6(inet_naddr_t *, uint16_t, uint16_t, uint16_t, uint16_t, 90 uint16_t, uint16_t, uint16_t, uint16_t, uint8_t); 91 92 extern int inet_addr_family(const char *, uint16_t *); 93 extern void inet_naddr_addr(const inet_naddr_t *, inet_addr_t *); 94 extern void inet_addr_naddr(const inet_addr_t *, uint8_t, inet_naddr_t *); 95 96 extern void inet_addr_any(inet_addr_t *); 97 extern void inet_naddr_any(inet_naddr_t *); 98 99 extern int inet_addr_compare(const inet_addr_t *, const inet_addr_t *); 100 extern int inet_addr_is_any(const inet_addr_t *); 101 102 extern int inet_naddr_compare(const inet_naddr_t *, const inet_addr_t *); 103 extern int inet_naddr_compare_mask(const inet_naddr_t *, const inet_addr_t *); 104 105 extern int inet_addr_parse(const char *, inet_addr_t *); 53 106 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 **); 107 108 extern int inet_addr_format(const inet_addr_t *, char **); 109 extern int inet_naddr_format(const inet_naddr_t *, char **); 110 111 extern uint16_t inet_addr_get(const inet_addr_t *, addr32_t *, addr128_t *); 112 extern uint16_t inet_naddr_get(const inet_naddr_t *, addr32_t *, addr128_t *, 113 uint8_t *); 114 115 extern void inet_addr_set(addr32_t, inet_addr_t *); 116 extern void inet_naddr_set(addr32_t, uint8_t, inet_naddr_t *); 117 extern void inet_sockaddr_in_addr(const sockaddr_in_t *, inet_addr_t *); 118 119 extern void inet_addr_set6(addr128_t, inet_addr_t *); 120 extern void inet_naddr_set6(addr128_t, uint8_t, inet_naddr_t *); 121 extern void inet_sockaddr_in6_addr(const sockaddr_in6_t *, inet_addr_t *); 122 123 extern uint16_t inet_addr_sockaddr_in(const inet_addr_t *, sockaddr_in_t *, 124 sockaddr_in6_t *); 57 125 58 126 #endif -
uspace/lib/c/include/inet/dnsr.h
rf2c19b0 r03c971f 37 37 38 38 #include <inet/inet.h> 39 #include <inet/addr.h> 39 40 40 41 enum { … … 50 51 51 52 extern int dnsr_init(void); 52 extern int dnsr_name2host(const char *, dnsr_hostinfo_t ** );53 extern int dnsr_name2host(const char *, dnsr_hostinfo_t **, uint16_t); 53 54 extern void dnsr_hostinfo_destroy(dnsr_hostinfo_t *); 54 55 extern int dnsr_get_srvaddr(inet_addr_t *); -
uspace/lib/c/include/inet/inetping.h
rf2c19b0 r03c971f 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
rf2c19b0 r03c971f 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 /** IPv4 link Service Data Unit */ 53 50 typedef struct { 54 51 /** Local source address */ 55 iplink_addr_t lsrc;52 addr32_t src; 56 53 /** Local destination address */ 57 iplink_addr_t ldest;54 addr32_t dest; 58 55 /** Serialized IP packet */ 59 56 void *data; … … 62 59 } iplink_sdu_t; 63 60 61 /** IPv6 link Service Data Unit */ 62 typedef struct { 63 /** Local MAC destination address */ 64 addr48_t dest; 65 /** Serialized IP packet */ 66 void *data; 67 /** Size of @c data in bytes */ 68 size_t size; 69 } iplink_sdu6_t; 70 71 /** Internet link receive Service Data Unit */ 72 typedef struct { 73 /** Serialized datagram */ 74 void *data; 75 /** Size of @c data in bytes */ 76 size_t size; 77 } iplink_recv_sdu_t; 78 64 79 typedef struct iplink_ev_ops { 65 int (*recv)(iplink_t *, iplink_ sdu_t *);80 int (*recv)(iplink_t *, iplink_recv_sdu_t *, uint16_t); 66 81 } iplink_ev_ops_t; 67 82 … … 69 84 extern void iplink_close(iplink_t *); 70 85 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 *); 86 extern int iplink_send6(iplink_t *, iplink_sdu6_t *); 87 extern int iplink_addr_add(iplink_t *, inet_addr_t *); 88 extern int iplink_addr_remove(iplink_t *, inet_addr_t *); 73 89 extern int iplink_get_mtu(iplink_t *, size_t *); 90 extern int iplink_get_mac48(iplink_t *, addr48_t *); 74 91 75 92 #endif -
uspace/lib/c/include/inet/iplink_srv.h
rf2c19b0 r03c971f 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_srv_sdu_t *); 58 int (*send)(iplink_srv_t *, iplink_sdu_t *); 59 int (*send6)(iplink_srv_t *, iplink_sdu6_t *); 73 60 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 *); 61 int (*get_mac48)(iplink_srv_t *, addr48_t *); 62 int (*addr_add)(iplink_srv_t *, inet_addr_t *); 63 int (*addr_remove)(iplink_srv_t *, inet_addr_t *); 76 64 } iplink_ops_t; 77 65 … … 79 67 80 68 extern int iplink_conn(ipc_callid_t, ipc_call_t *, void *); 81 extern int iplink_ev_recv(iplink_srv_t *, iplink_ srv_sdu_t *);69 extern int iplink_ev_recv(iplink_srv_t *, iplink_recv_sdu_t *, uint16_t); 82 70 83 71 #endif -
uspace/lib/c/include/io/con_srv.h
rf2c19b0 r03c971f 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/io/verify.h
rf2c19b0 r03c971f 38 38 #ifndef NVERIFY_PRINTF 39 39 40 #ifdef __clang__ 41 #define PRINTF_ATTRIBUTE(start, end) \ 42 __attribute__((format(__printf__, start, end))) 43 #else 40 44 #define PRINTF_ATTRIBUTE(start, end) \ 41 45 __attribute__((format(gnu_printf, start, end))) 46 #endif 42 47 43 48 #else /* NVERIFY_PRINTF */ -
uspace/lib/c/include/ipc/inet.h
rf2c19b0 r03c971f 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/iplink.h
rf2c19b0 r03c971f 40 40 typedef enum { 41 41 IPLINK_GET_MTU = IPC_FIRST_USER_METHOD, 42 IPLINK_GET_MAC48, 42 43 IPLINK_SEND, 44 IPLINK_SEND6, 43 45 IPLINK_ADDR_ADD, 44 46 IPLINK_ADDR_REMOVE -
uspace/lib/c/include/ipc/services.h
rf2c19b0 r03c971f 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
rf2c19b0 r03c971f 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
rf2c19b0 r03c971f 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
rf2c19b0 r03c971f 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
rf2c19b0 r03c971f 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
rf2c19b0 r03c971f 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
rf2c19b0 r03c971f 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/stdio.h
rf2c19b0 r03c971f 143 143 144 144 extern void setvbuf(FILE *, void *, int, size_t); 145 extern void setbuf(FILE *, void *); 145 146 146 147 /* Misc file functions */ -
uspace/lib/c/include/str.h
rf2c19b0 r03c971f 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.
