/**
 * @file net.h
 *
 * @brief Network utility functions (header).
 *
 * Copyright 2007-2008, Freie Universitaet Berlin. All rights reserved.
 * Please refer to the COPYING file for detailed licensing information.
 *
 * @author Georg Wittenburg
 *
 * $Id: net.h 2685 2008-06-25 16:38:56Z wittenbu $
 */

#ifndef UTIL_NET_H
#define UTIL_NET_H

#include "../types.h"

char* addr_to_str(C_addr_t addr);
void init_header(packet_header_t* header, C_addr_t to, uint8_t app, uint8_t type);
void C_sendto(C_addr_t to, uint8_t app, uint8_t type, const void* payload, size_t payload_length);
void C_sendto2(C_addr_t to, uint8_t app, uint8_t type, const void* payload1, size_t payload_length1, const void* payload2, size_t payload_length2);
void forward(const packet_header_t* header, const void* payload);
bool check_for_duplicate(packet_fingerprint_t* cache, uint16_t cache_size, const packet_header_t* header);
void init_node(node_t* node, C_addr_t address);
bool matches_node_addr(const void* item, const void* cmp_item);
bool node_addr_less_than(const void* item, const void* cmp_item);
void print_node_addr(const void* item);
void print_node_addr_and_distance(const void* item);
void add_node_to_network_map(C_addr_t address, uint8_t hops, C_addr_t last_hop);
void calculate_network_statistics();

#endif	// UTIL_NET_H
