Changeset 19a4f73 in mainline for uspace/lib/c/generic/inet/addr2.c


Ignore:
Timestamp:
2013-06-20T15:21:48Z (11 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a2e3ee6
Parents:
3e66428
Message:

udp: use new network address infrastructure (towards IPv6 support)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/inet/addr2.c

    r3e66428 r19a4f73  
    4040#include <stdio.h>
    4141
     42// TODO temporarily
     43#include <assert.h>
     44
     45static inet2_addr_t inet2_addr_any = {
     46        .family = AF_INET,
     47        .addr = {0, 0, 0, 0}
     48};
     49
     50static inet2_addr_t inet2_addr6_any = {
     51        .family = AF_INET6,
     52        .addr = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
     53};
     54
    4255/** Parse network address family.
    4356 *
     
    336349}
    337350
    338 int inet2_addr_is_empty(inet2_addr_t *addr)
    339 {
    340         return (addr->family == 0);
     351int inet2_addr_is_any(inet2_addr_t *addr)
     352{
     353        return ((addr->family == 0) ||
     354            (inet2_addr_compare(addr, &inet2_addr_any)) ||
     355            (inet2_addr_compare(addr, &inet2_addr6_any)));
     356}
     357
     358void inet_inet2(inet_addr_t *addr, inet2_addr_t *addr2)
     359{
     360        // TODO temporarily
     361        inet2_addr_unpack(addr->ipv4, addr2);
     362}
     363
     364void inet2_inet(inet2_addr_t *addr2, inet_addr_t *addr)
     365{
     366        // TODO temporarily
     367        assert(addr2->family == AF_INET);
     368        inet2_addr_pack(addr2, &addr->ipv4);
    341369}
    342370
Note: See TracChangeset for help on using the changeset viewer.