/home/aaron/olsrd-current/olsrd/src/core/ipcalc.h File Reference

#include "olsr_types.h"
#include "defs.h"
#include "olsr_cfg.h"
#include "common/string.h"
#include <limits.h>
#include <arpa/inet.h>
Include dependency graph for ipcalc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ipaddr_str
struct  ipprefix_str

Functions

static INLINE int ip4cmp (const struct in_addr *a, const struct in_addr *b)
static INLINE int ip6cmp (const struct in6_addr *a, const struct in6_addr *b)
static INLINE int ipcmp (int ip_version, const union olsr_ip_addr *a, const union olsr_ip_addr *b)
static INLINE int olsr_ipcmp (const union olsr_ip_addr *a, const union olsr_ip_addr *b)
static INLINE void genipcopy (void *dst, const void *src)
int ip_in_net (const union olsr_ip_addr *ipaddr, const struct olsr_ip_prefix *net, int ip_version)
int EXPORT() prefix_to_netmask (uint8_t *, int, uint8_t)
static INLINE int olsr_prefix_to_netmask (union olsr_ip_addr *adr, uint8_t prefixlen)
uint8_t EXPORT() netmask_to_prefix (const uint8_t *, int)
static INLINE uint8_t olsr_netmask_to_prefix (const union olsr_ip_addr *adr)
static INLINE uint8_t olsr_netmask4_to_prefix (const uint32_t *a)
static INLINE uint8_t olsr_netmask6_to_prefix (const struct in6_addr *a)
static INLINE const char * ip4_to_string (struct ipaddr_str *const buf, const struct in_addr addr4)
static INLINE const char * ip6_to_string (struct ipaddr_str *const buf, const struct in6_addr *const addr6)
static INLINE const char * olsr_sockaddr_to_string (struct ipaddr_str *const buf, const union olsr_sockaddr *s)
static INLINE const char * ip_to_string (int af, struct ipaddr_str *const buf, const union olsr_ip_addr *addr)
static INLINE const char * olsr_ip_to_string (struct ipaddr_str *const buf, const union olsr_ip_addr *addr)
const char *EXPORT() ip_prefix_to_string (int af, struct ipprefix_str *const buf, const struct olsr_ip_prefix *prefix)
static INLINE const char * olsr_ip_prefix_to_string (struct ipprefix_str *const buf, const struct olsr_ip_prefix *prefix)
const char * sockaddr_to_string (char *buf, int bufsize, const struct sockaddr *const addr, unsigned int addrsize)
static INLINE uint32_t prefix_to_netmask4 (uint8_t prefixlen)
struct in6_addr EXPORT (in6addr_v4mapped_loopback)
void EXPORT() ip_map_4to6 (union olsr_ip_addr *ip)
static INLINE bool is_prefix_niit_ipv6 (const struct olsr_ip_prefix *p)
static INLINE struct
olsr_ip_prefix
prefix_mappedv4_to_v4 (struct olsr_ip_prefix *v4, const struct olsr_ip_prefix *v6)
static INLINE bool ip_is_linklocal (const union olsr_ip_addr *ip)
static INLINE bool ip_prefix_is_mappedv4 (const struct olsr_ip_prefix *prefix)
static INLINE bool ip_prefix_is_mappedv4_inetgw (const struct olsr_ip_prefix *prefix)
static INLINE bool ip_prefix_is_v4_inetgw (const struct olsr_ip_prefix *prefix)
static INLINE bool ip_prefix_is_v6_inetgw (const struct olsr_ip_prefix *prefix)
bool is_prefix_inetgw (const struct olsr_ip_prefix *prefix)

Variables

union olsr_ip_addr all_zero
struct olsr_ip_prefix ipv4_internet_route
struct olsr_ip_prefix ipv6_mappedv4_route
struct olsr_ip_prefix ipv6_internet_route

Function Documentation

struct in6_addr EXPORT ( in6addr_v4mapped_loopback   )  [read]
static INLINE void genipcopy ( void *  dst,
const void *  src 
) [static]

Definition at line 107 of file ipcalc.h.

References olsr_config::ipsize, and olsr_cnf.

static INLINE const char* ip4_to_string ( struct ipaddr_str *const   buf,
const struct in_addr  addr4 
) [static]
static INLINE int ip4cmp ( const struct in_addr *  a,
const struct in_addr *  b 
) [static]
static INLINE const char* ip6_to_string ( struct ipaddr_str *const   buf,
const struct in6_addr *const   addr6 
) [static]

Definition at line 149 of file ipcalc.h.

References AF_INET6, ipaddr_str::buf, and inet_ntop().

Referenced by chk_if_changed(), os_init_interface(), parse_cfg_interface(), and txtinfo_interfaces().

Here is the call graph for this function:

static INLINE int ip6cmp ( const struct in6_addr a,
const struct in6_addr b 
) [static]
int ip_in_net ( const union olsr_ip_addr ipaddr,
const struct olsr_ip_prefix net,
int  ip_version 
)

Definition at line 179 of file ipcalc.c.

References ARM_NOWARN_ALIGN, olsr_ip_prefix::prefix, olsr_ip_prefix::prefix_len, prefix_to_netmask4(), in6_addr::s6_addr, olsr_ip_addr::v4, and olsr_ip_addr::v6.

Referenced by get_ipv6_address(), and ip_acl_acceptable().

Here is the call graph for this function:

static INLINE bool ip_is_linklocal ( const union olsr_ip_addr ip  )  [static]

Definition at line 217 of file ipcalc.h.

References AF_INET6, olsr_config::ip_version, olsr_cnf, in6_addr::s6_addr, and olsr_ip_addr::v6.

void EXPORT() ip_map_4to6 ( union olsr_ip_addr ip  ) 

Definition at line 85 of file ipcalc.c.

References in6_addr::s6_addr, olsr_ip_addr::v4, and olsr_ip_addr::v6.

Referenced by ip_acl_plugin_parse().

static INLINE bool ip_prefix_is_mappedv4 ( const struct olsr_ip_prefix prefix  )  [static]

Definition at line 223 of file ipcalc.h.

References ipv6_mappedv4_route, and olsr_ip_prefix::prefix_len.

static INLINE bool ip_prefix_is_mappedv4_inetgw ( const struct olsr_ip_prefix prefix  )  [static]

Definition at line 229 of file ipcalc.h.

References ipv6_mappedv4_route, and olsr_ip_prefix::prefix_len.

Referenced by is_prefix_inetgw(), and olsr_os_niit_6to4_route().

static INLINE bool ip_prefix_is_v4_inetgw ( const struct olsr_ip_prefix prefix  )  [static]
static INLINE bool ip_prefix_is_v6_inetgw ( const struct olsr_ip_prefix prefix  )  [static]

Definition at line 241 of file ipcalc.h.

References ipv6_internet_route, and olsr_ip_prefix::prefix_len.

Referenced by is_prefix_inetgw().

const char* EXPORT() ip_prefix_to_string ( int  af,
struct ipprefix_str *const   buf,
const struct olsr_ip_prefix prefix 
)

Definition at line 165 of file ipcalc.c.

References ipprefix_str::buf, inet_ntop(), olsr_ip_prefix::prefix, and olsr_ip_prefix::prefix_len.

Referenced by olsr_ip_prefix_to_string(), and olsr_write_cnf_buf().

Here is the call graph for this function:

static INLINE const char* ip_to_string ( int  af,
struct ipaddr_str *const   buf,
const union olsr_ip_addr addr 
) [static]

Definition at line 169 of file ipcalc.h.

References ipaddr_str::buf, and inet_ntop().

Referenced by olsr_ip_to_string(), parse_cfg_hna(), and parse_cfg_interface().

Here is the call graph for this function:

static INLINE int ipcmp ( int  ip_version,
const union olsr_ip_addr a,
const union olsr_ip_addr b 
) [static]

Definition at line 92 of file ipcalc.h.

References ip4cmp(), ip6cmp(), olsr_ip_addr::v4, and olsr_ip_addr::v6.

Referenced by ip_prefix_list_find(), ip_prefix_list_remove(), and olsr_ipcmp().

Here is the call graph for this function:

bool is_prefix_inetgw ( const struct olsr_ip_prefix prefix  ) 

Definition at line 251 of file ipcalc.c.

References AF_INET6, ip_prefix_is_mappedv4_inetgw(), ip_prefix_is_v4_inetgw(), ip_prefix_is_v6_inetgw(), olsr_config::ip_version, and olsr_cnf.

Referenced by olsr_os_process_rt_entry().

Here is the call graph for this function:

static INLINE bool is_prefix_niit_ipv6 ( const struct olsr_ip_prefix p  )  [static]
uint8_t EXPORT() netmask_to_prefix ( const uint8_t *  ,
int   
)
static INLINE const char* olsr_ip_prefix_to_string ( struct ipprefix_str *const   buf,
const struct olsr_ip_prefix prefix 
) [static]
static INLINE const char* olsr_ip_to_string ( struct ipaddr_str *const   buf,
const union olsr_ip_addr addr 
) [static]

Definition at line 175 of file ipcalc.h.

References ip_to_string(), olsr_config::ip_version, and olsr_cnf.

Referenced by add_interface(), add_link_entry(), add_lost_interface_ip(), allowed_hostname_or_ip_in_service(), allowed_ip(), arproaming_client_add(), arproaming_client_update(), BmfEncapsulationPacketReceived(), BmfPacketCaptured(), BmfTunPacketCaptured(), build_config_body(), build_ipaddr_link(), build_mid_body(), build_neigh_body(), check_gw(), chk_if_changed(), create_packet(), debuginfo_print_trafficip(), decap_namemsg(), DoBmf(), FindNeighbors(), hello_tap(), insert_new_name_in_list(), internal_delete_tc_edge_entry(), ipc_print_neigh_link(), ipc_print_net(), ipc_print_tc_link(), join_mcast(), lookup_link_entry(), lookup_timestamp_entry(), lq_etxff_packet_parser(), lq_etxff_timer(), main(), mapwrite_work(), olsr_add_invalid_address(), olsr_add_nbr2_entry(), olsr_add_nbr_entry(), olsr_add_tc_edge_entry(), olsr_add_tc_entry(), olsr_calculate_routing_table(), olsr_com_handle_htmlsite(), olsr_com_handle_txtcommand(), olsr_com_parse_connection(), olsr_com_parse_request(), olsr_delete_link_entry_by_if(), olsr_delete_nbr2_entry(), olsr_delete_nbr_entry(), olsr_delete_routing_table(), olsr_delete_tc_entry(), olsr_expire_hna_net_entry(), olsr_expire_mid_entries(), olsr_expire_tc_edge_gc(), olsr_expire_tc_entry(), olsr_fixup_mid_main_addr(), olsr_flush_hna_nets(), olsr_flush_nbr2_duplicates(), olsr_forward_message(), olsr_input(), olsr_input_hna(), olsr_input_mid(), olsr_input_tc(), olsr_insert_mid_entry(), olsr_insert_routing_table(), olsr_is_duplicate_message(), olsr_msg_statistics(), olsr_namesvc_delete_db_entry(), olsr_new_netlink_route(), olsr_os_process_rt_entry(), olsr_parser(), olsr_print_duplicate_table(), olsr_print_hna_set(), olsr_print_link_set(), olsr_print_mid_set(), olsr_print_neighbor_table(), olsr_print_routing_table(), olsr_print_tc_table(), olsr_rt_to_string(), olsr_rtp_to_string(), olsr_spf_add_cand_tree(), olsr_spf_add_path_list(), olsr_spf_del_cand_tree(), olsr_spf_relax(), olsr_tc_edge_to_string(), olsr_update_nbr_status(), olsr_validate_address(), parse_challenge(), parse_cres(), parse_http_request(), parse_packet(), parse_rres(), remove_lost_interface_ip(), remove_nonvalid_names_from_list(), secure_preprocessor(), select_best_nameserver(), send_challenge(), send_cres(), send_rres(), timeout_timestamps(), txtinfo_hna(), txtinfo_link(), txtinfo_mid(), txtinfo_neigh(), txtinfo_neigh2(), txtinfo_routes(), txtinfo_topology(), update_name_entry(), validate_packet(), write_hosts_file(), write_resolv_file(), and write_services_file().

Here is the call graph for this function:

static INLINE int olsr_ipcmp ( const union olsr_ip_addr a,
const union olsr_ip_addr b 
) [static]
static INLINE uint8_t olsr_netmask4_to_prefix ( const uint32_t *  a  )  [static]

Definition at line 132 of file ipcalc.h.

References netmask_to_prefix().

Here is the call graph for this function:

static INLINE uint8_t olsr_netmask6_to_prefix ( const struct in6_addr a  )  [static]

Definition at line 137 of file ipcalc.h.

References netmask_to_prefix().

Here is the call graph for this function:

static INLINE uint8_t olsr_netmask_to_prefix ( const union olsr_ip_addr adr  )  [static]
static INLINE int olsr_prefix_to_netmask ( union olsr_ip_addr adr,
uint8_t  prefixlen 
) [static]
static INLINE const char* olsr_sockaddr_to_string ( struct ipaddr_str *const   buf,
const union olsr_sockaddr s 
) [static]

Definition at line 155 of file ipcalc.h.

References AF_INET6, ipaddr_str::buf, inet_ntop(), sockaddr_in6::sin6_addr, olsr_sockaddr::storage, strscpy(), olsr_sockaddr::v4, and olsr_sockaddr::v6.

Referenced by build_config_body(), join_mcast(), mapwrite_work(), and net_output().

Here is the call graph for this function:

static INLINE struct olsr_ip_prefix* prefix_mappedv4_to_v4 ( struct olsr_ip_prefix v4,
const struct olsr_ip_prefix v6 
) [static, read]
int EXPORT() prefix_to_netmask ( uint8_t *  ,
int  ,
uint8_t   
)

Definition at line 93 of file ipcalc.c.

References MIN.

Referenced by olsr_prefix_to_netmask(), and pkt_put_prefixlen().

static INLINE uint32_t prefix_to_netmask4 ( uint8_t  prefixlen  )  [static]

Definition at line 194 of file ipcalc.h.

Referenced by ip_in_net().

const char* sockaddr_to_string ( char *  buf,
int  bufsize,
const struct sockaddr *const   addr,
unsigned int  addrsize 
)

Definition at line 228 of file ipcalc.c.

References AF_INET6, MIN, sockaddr4_to_string(), and sockaddr6_to_string().

Referenced by olsr_input().

Here is the call graph for this function:


Variable Documentation

Definition at line 63 of file ipcalc.c.

Referenced by ip_prefix_is_v4_inetgw(), and olsr_os_inetgw_tunnel_route().

Definition at line 77 of file ipcalc.c.

Referenced by ip_prefix_is_v6_inetgw(), and olsr_os_inetgw_tunnel_route().

Generated on Fri May 24 06:00:03 2013 for olsrd by  doxygen 1.6.3