Changeset 98abd40 in mainline for uspace/lib/c/include/inet/addr.h


Ignore:
Timestamp:
2013-07-06T21:57:22Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
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.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/inet/addr.h

    rb8e72fd1 r98abd40  
    3737
    3838#include <stdint.h>
     39#include <net/in.h>
     40#include <net/in6.h>
     41
     42typedef uint32_t addr32_t;
     43typedef uint8_t addr48_t[6];
     44typedef uint8_t addr128_t[16];
    3945
    4046/** Node address */
    4147typedef struct {
    42         uint32_t ipv4;
     48        uint16_t family;
     49        union {
     50                addr32_t addr;
     51                addr128_t addr6;
     52        };
    4353} inet_addr_t;
    4454
    4555/** Network address */
    4656typedef struct {
     57        /** Address family */
     58        uint16_t family;
     59       
    4760        /** 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;
    5168} inet_naddr_t;
    5269
     70extern const addr48_t addr48_broadcast;
     71
     72extern void addr48(const addr48_t, addr48_t);
     73extern void addr128(const addr128_t, addr128_t);
     74
     75extern void host2addr128_t_be(const addr128_t, addr128_t);
     76extern void addr128_t_be2host(const addr128_t, addr128_t);
     77
     78extern void inet_addr(inet_addr_t *, uint8_t, uint8_t, uint8_t, uint8_t);
     79extern void inet_naddr(inet_naddr_t *, uint8_t, uint8_t, uint8_t, uint8_t,
     80    uint8_t);
     81
     82extern void inet_addr6(inet_addr_t *, uint16_t, uint16_t, uint16_t, uint16_t,
     83    uint16_t, uint16_t, uint16_t, uint16_t);
     84extern 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
     87extern int inet_addr_family(const char *, uint16_t *);
     88extern void inet_naddr_addr(const inet_naddr_t *, inet_addr_t *);
     89
     90extern void inet_addr_any(inet_addr_t *);
     91extern void inet_naddr_any(inet_naddr_t *);
     92
     93extern int inet_addr_compare(const inet_addr_t *, const inet_addr_t *);
     94extern int inet_addr_is_any(const inet_addr_t *);
     95
     96extern int inet_naddr_compare_mask(const inet_naddr_t *, const inet_addr_t *);
     97
     98extern int inet_addr_parse(const char *, inet_addr_t *);
    5399extern 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
     101extern int inet_addr_format(const inet_addr_t *, char **);
     102extern int inet_naddr_format(const inet_naddr_t *, char **);
     103
     104extern uint16_t inet_addr_get(const inet_addr_t *, addr32_t *, addr128_t *);
     105extern uint16_t inet_naddr_get(const inet_naddr_t *, addr32_t *, addr128_t *,
     106    uint8_t *);
     107
     108extern void inet_addr_set(addr32_t, inet_addr_t *);
     109extern void inet_naddr_set(addr32_t, uint8_t, inet_naddr_t *);
     110extern void inet_sockaddr_in_addr(const sockaddr_in_t *, inet_addr_t *);
     111
     112extern void inet_addr_set6(addr128_t, inet_addr_t *);
     113extern void inet_naddr_set6(addr128_t, uint8_t, inet_naddr_t *);
     114extern void inet_sockaddr_in6_addr(const sockaddr_in6_t *, inet_addr_t *);
     115
     116extern uint16_t inet_addr_sockaddr_in(const inet_addr_t *, sockaddr_in_t *,
     117    sockaddr_in6_t *);
    57118
    58119#endif
Note: See TracChangeset for help on using the changeset viewer.