Changeset 98abd40 in mainline for uspace/lib/c/include/inet/addr.h
- Timestamp:
- 2013-07-06T21:57:22Z (11 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.