DTS Application Library  0.2.3
Application library containing referenced objects and interfaces to common libraries
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

IPv4 And IPv6 Utiliies. More...

#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <linux/ip.h>
#include <linux/icmp.h>
#include <linux/tcp.h>
#include <linux/udp.h>
#include <netdb.h>
#include "include/dtsapp.h"

Go to the source code of this file.

Data Structures

struct  pseudohdr
 IPv4 header structur to cast a packet too. More...
 

Enumerations

enum  ipversion { IP_PROTO_V4 = 4, IP_PROTO_V6 = 6 }
 IP Protocol numbers. More...
 

Functions

int checkipv6mask (const char *ipaddr, const char *network, uint8_t bits)
 Check if ipaddr is in a network. More...
 
void ipv4tcpchecksum (uint8_t *pkt)
 Update the TCP checksum of a IPv4 packet. More...
 
void ipv4udpchecksum (uint8_t *pkt)
 Update the UDP checksum of a IPv4 packet. More...
 
void ipv4icmpchecksum (uint8_t *pkt)
 Set the checksup of a IPv4 ICMP packet. More...
 
void ipv4checksum (uint8_t *pkt)
 Set the checksup of a IPv4 Packet. More...
 
int packetchecksumv4 (uint8_t *pkt)
 Update the checksum of a IPv4 packet. More...
 
int packetchecksumv6 (uint8_t *pkt)
 Prototype to check checksup on packet. More...
 
int packetchecksum (uint8_t *pkt)
 Generic IPv4 and IPv6 Checksum. More...
 
const char * cidrtosn (int bitlen, char *buf, int size)
 Return the dotted quad notation subnet mask from a CIDR. More...
 
const char * getnetaddr (const char *ipaddr, int cidr, char *buf, int size)
 Return the network address. More...
 
const char * getfirstaddr (const char *ipaddr, int cidr, char *buf, int size)
 Get the first usable address. More...
 
const char * getbcaddr (const char *ipaddr, int cidr, char *buf, int size)
 Return broadcast address. More...
 
const char * getlastaddr (const char *ipaddr, int cidr, char *buf, int size)
 Get the last usable address. More...
 
uint32_t cidrcnt (int bitlen)
 Return the number of IP addresses in a given bitmask. More...
 
int reservedip (const char *ipaddr)
 Check IP against list of reserved IP's. More...
 
char * ipv6to4prefix (const char *ipaddr)
 Return IPv6 to IPv4 Prefix fot the address. More...
 
int check_ipv4 (const char *ip, int cidr, const char *test)
 Check if a IP address is in a network. More...
 
void mcast6_ip (struct in6_addr *addr)
 Randomally assign a SSM Multicast address.param addr Ip address structure to fill out. More...
 
void mcast4_ip (struct in_addr *addr)
 Randomally assign a SSM Multicast address. More...
 
int inet_lookup (int family, const char *host, void *addr, socklen_t len)
 Perform DNS lookup on a host/ip retun the IP address. More...
 

Detailed Description

IPv4 And IPv6 Utiliies.

Definition in file iputil.c.