IBR-DTNSuite
0.8
|
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "receiver.h"
#include "ip.h"
Go to the source code of this file.
Defines | |
#define | PING_BOOSTER |
Functions | |
void | process_ipv4 (uint16_t size, char *packet) |
void | process_icmp (uint16_t size, char *packet, uint16_t icmp_offset) |
uint16_t | ip_checksum (void *start, unsigned int count, uint32_t initial_value) |
void | process_packet (uint16_t size, char *packet) |
void | print_packet (uint16_t size, char *packet) |
void * | receiver_run (void *arg) |
#define PING_BOOSTER |
Definition at line 66 of file receiver.c.
uint16_t ip_checksum | ( | void * | start, |
unsigned int | count, | ||
uint32_t | initial_value | ||
) |
Calculates a IP checksum (as needed by IP, TCP and UDP). Parameters are start points to the beginning of the data to be checksummed count Indicates how many bytes should be checksummed Since protcols like IP and UDP work with so called Pseudo Headers (see RFC for details) you can precalculate that part and give it as initial_value to this function
Definition at line 134 of file receiver.c.
Referenced by process_icmp().
void print_packet | ( | uint16_t | size, |
char * | packet | ||
) |
Definition at line 32 of file receiver.c.
Referenced by process_icmp(), and receiver_run().
void process_icmp | ( | uint16_t | size, |
char * | packet, | ||
uint16_t | icmp_offset | ||
) |
Definition at line 67 of file receiver.c.
References GET_UINT32, ICMP_CODE, ICMP_CRC, ICMP_ECHO_REPLY, ICMP_ECHO_REQUEST, ICMP_TYPE, ip_checksum(), IPV4_CHECKSUM, IPV4_DESTINATION, IPV4_SOURCE, print_packet(), SET_UINT16, and SET_UINT32.
Referenced by process_ipv4().
void process_ipv4 | ( | uint16_t | size, |
char * | packet | ||
) |
Definition at line 39 of file receiver.c.
References IP_PROT_ICMP, IP_PROT_TCP, IP_PROT_UDP, IPV4_PROTOCOL, and process_icmp().
Referenced by process_packet().
void process_packet | ( | uint16_t | size, |
char * | packet | ||
) |
Definition at line 19 of file receiver.c.
References IP_VERSION, and process_ipv4().
Referenced by receiver_run().
void* receiver_run | ( | void * | arg | ) |
Definition at line 159 of file receiver.c.
References BUFSIZE, print_packet(), and process_packet().
Referenced by main().