The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
netaddr.c File Reference

Defines interfaces for the NetAddr (network address) object. More...

#include <stdlib.h>
#include <memory.h>
#include <ctype.h>
#include <projectcommon.h>
#include <netaddr.h>
#include <address_family_numbers.h>
Include dependency graph for netaddr.c:

Go to the source code of this file.

Macros

#define CHAR_BIT   8
 

Functions

FSTATIC struct sockaddr_in6 _netaddr_ipv6sockaddr (const NetAddr *self)
 
FSTATIC struct sockaddr_in _netaddr_ipv4sockaddr (const NetAddr *self)
 
FSTATIC void _netaddr_finalize (AssimObj *base)
 Finalize (free) this object. More...
 
FSTATIC guint16 _netaddr_port (const NetAddr *self)
 Return the port of this NetAddr. More...
 
FSTATIC void _netaddr_setport (NetAddr *self, guint16 port)
 Set the port of this NetAddr. More...
 
FSTATIC guint16 _netaddr_addrtype (const NetAddr *self)
 Return the address type of this NetAddr. More...
 
FSTATIC gboolean _netaddr_ismcast (const NetAddr *self)
 Return TRUE if this is a multicast address. More...
 
FSTATIC gboolean _netaddr_islocal (const NetAddr *self)
 Return TRUE if this is a multicast address. More...
 
FSTATIC gboolean _netaddr_isanyaddr (const NetAddr *self)
 
FSTATIC gconstpointer _netaddr_addrinnetorder (gsize *addrlen)
 
FSTATIC gboolean _netaddr_equal (const NetAddr *self, const NetAddr *other)
 Return TRUE if these two addresses are "equal" (equivalent) More...
 
FSTATIC guint _netaddr_hash (const NetAddr *self)
 NetAddr hash function which worries about denial of service via hash collisions. More...
 
FSTATIC gchar * _netaddr_toStringflex (const NetAddr *self, gboolean canon_format)
 Convert this NetAddr to a string. More...
 
FSTATIC gchar * _netaddr_toString (gconstpointer baseobj)
 Convert this IPv6-encapsulated IPv4 NetAddr to an IPv4 representation Convert this NetAddr to a string. More...
 
FSTATIC gchar * _netaddr_canonStr (const NetAddr *)
 
FSTATIC NetAddr_netaddr_toIPv6 (const NetAddr *self)
 Convert this IPv6-encapsulated IPv4 NetAddr to an IPv4 representation. More...
 
FSTATIC gchar * _netaddr_toString_ipv6_ipv4 (const NetAddr *self, gboolean ipv4format)
 Convert this IPv6-encapsulated IPv4 NetAddr to a string. More...
 
FSTATIC NetAddr_netaddr_string_ipv4_new (const char *addrstr)
 Convert a string to an IPv4 NetAddr. More...
 
FSTATIC NetAddr_netaddr_string_ipv6_new (const char *addrstr)
 Convert a string into an IPv6 address - possibly including a port as per RFC 4291. More...
 
FSTATIC NetAddr_netaddr_string_macaddr_new (const char *addrstr)
 Create a NetAddr from a 48-bit or 64-bit-format MAC address string. More...
 
WINEXPORT gboolean netaddr_g_hash_equal (gconstpointer lhs, gconstpointer rhs)
 g_hash_table equal comparator for a NetAddr More...
 
WINEXPORT guint netaddr_g_hash_hash (gconstpointer addrptr)
 g_hash_table hash function for a NetAddr More...
 
NetAddrnetaddr_new (gsize objsize, guint16 port, guint16 addrtype, gconstpointer addrbody, guint16 addrlen)
 Generic NetAddr constructor. More...
 
NetAddrnetaddr_string_new (const char *addrstr)
 Create a NetAddr from an ipv4, ipv6 or MAC address string. More...
 
NetAddrnetaddr_dns_new (const char *sysname_or_addr)
 Create a NetAddr from a DNS name or an ipv4 or ipv6 constant string. More...
 
NetAddrnetaddr_macaddr_new (gconstpointer macbuf, guint16 maclen)
 Create new NetAddr from a MAC address. More...
 
NetAddrnetaddr_mac48_new (gconstpointer macbuf)
 Create new NetAddr from a MAC48 address. More...
 
NetAddrnetaddr_mac64_new (gconstpointer macbuf)
 Create new NetAddr from a MAC64 address. More...
 
NetAddrnetaddr_ipv4_new (gconstpointer ipbuf, guint16 port)
 Create new NetAddr from a IPv4 address. More...
 
NetAddrnetaddr_ipv6_new (gconstpointer ipbuf, guint16 port)
 Create new NetAddr from a IPv6 address. More...
 
NetAddrnetaddr_sockaddr_new (const struct sockaddr_in6 *sa_in6, socklen_t length)
 Create new NetAddr from a struct sockaddr More...
 

Detailed Description

Defines interfaces for the NetAddr (network address) object.

These can be various kinds of network addresses - IPV4, IPv6, MAC addresses, etc. as enumerated by IANA, and covered by RFC 3232. This class implements a basic API on these objects.

This file is part of the Assimilation Project.

Author
Copyright © 2011, 2012 - Alan Robertson alanr.nosp@m.@uni.nosp@m.x.sh
The Assimilation software is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Assimilation software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the Assimilation Project software. If not, see http://www.gnu.org/licenses/

Definition in file netaddr.c.

Function Documentation

FSTATIC gconstpointer _netaddr_addrinnetorder ( gsize *  addrlen)