icmp.c File Reference

ICMP module implementation. More...

#include <async.h>
#include <atomic.h>
#include <fibril.h>
#include <fibril_synch.h>
#include <stdint.h>
#include <str.h>
#include <ipc/services.h>
#include <ipc/net.h>
#include <ipc/tl.h>
#include <ipc/icmp.h>
#include <sys/time.h>
#include <sys/types.h>
#include <byteorder.h>
#include <errno.h>
#include <adt/hash_table.h>
#include <net/socket_codes.h>
#include <net/ip_protocols.h>
#include <net/inet.h>
#include <net/modules.h>
#include <net/icmp_api.h>
#include <net/icmp_codes.h>
#include <net/icmp_common.h>
#include <packet_client.h>
#include <packet_remote.h>
#include <net_checksum.h>
#include <icmp_client.h>
#include <icmp_remote.h>
#include <il_remote.h>
#include <ip_client.h>
#include <ip_interface.h>
#include <net_interface.h>
#include <tl_remote.h>
#include <tl_skel.h>
#include <icmp_header.h>

Go to the source code of this file.

Data Structures

struct  icmp_reply_t
 ICMP reply data. More...

Defines

#define ICMP_CHECKSUM(header, length)   htons(ip_checksum((uint8_t *) (header), (length)))
 Compute the ICMP datagram checksum.
#define ICMP_ECHO_TEXT   "ICMP hello from HelenOS."
 An echo request datagrams pattern.
#define ICMP_KEEP_LENGTH   8
 Original datagram length in bytes transfered to the error notification message.
#define NAME   "icmp"
 ICMP module name.
#define REPLY_BUCKETS   1024
 Number of replies hash table buckets.
#define REPLY_KEYS   2
 Number of replies hash table keys.

Functions

static int icmp_destination_unreachable (icmp_code_t code, icmp_param_t mtu, packet_t *packet)
static int icmp_echo (icmp_param_t id, icmp_param_t sequence, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, bool dont_fragment, const struct sockaddr *addr, socklen_t addrlen)
 Request an echo message.
static int icmp_parameter_problem (icmp_code_t code, icmp_param_t pointer, packet_t *packet)
static icmp_header_ticmp_prepare_packet (packet_t *packet)
 Prepare the ICMP error packet.
static void icmp_process_echo_reply (packet_t *packet, icmp_header_t *header, icmp_type_t type, icmp_code_t code)
 Try to set the pending reply result as the received message type.
static int icmp_process_packet (packet_t *packet, services_t error)
 Process the received ICMP packet.
static void icmp_receiver (ipc_callid_t iid, ipc_call_t *icall)
 Process IPC messages from the IP module.
static void icmp_release (packet_t *packet)
 Release the packet and return the result.
static int icmp_send_packet (icmp_type_t type, icmp_code_t code, packet_t *packet, icmp_header_t *header, services_t error, ip_ttl_t ttl, ip_tos_t tos, bool dont_fragment)
 Send the ICMP message.
static int icmp_source_quench (packet_t *packet)
static int icmp_time_exceeded (icmp_code_t code, packet_t *packet)
int main (int argc, char *argv[])
 Main entry point.
static int replies_compare (unsigned long key[], hash_count_t keys, link_t *item)
static hash_index_t replies_hash (unsigned long key[])
static void replies_remove_callback (link_t *item)
void tl_connection (void)
 Per-connection module initialization.
int tl_initialize (int net_phone)
 Module initialization.
int tl_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, size_t *count)
 Process the transport layer module message.

Variables

static bool echo_replying = true
static bool error_reporting = true
static atomic_t icmp_client
 ICMP client identification counter.
static packet_dimension_t icmp_dimension
static fibril_local icmp_param_t icmp_id
 ICMP identifier and sequence number (client-specific).
static fibril_local icmp_param_t icmp_seq
static int phone_ip = -1
static int phone_net = -1
 Global data.
static hash_table_t replies
static fibril_mutex_t reply_lock
 Reply hash table.
static hash_table_operations_t reply_ops


Detailed Description

ICMP module implementation.

Definition in file icmp.c.


Generated on Thu Jun 2 07:45:55 2011 for HelenOS/USB by  doxygen 1.4.7