qlibs:

Section: Misc. Reference Manual Pages (ipv4)
Index Return to Main Contents
 

NAME

ipv4 - IPv4 address evaluation and conversion  

SYNTAX

#include "ip.h"

unsigned int ip4_fmt(char *s,char ip[4]);
unsigned int ip4_scan(const char *s,char ip[4]);
unsigned int ip4_scanbracket(char *s,char ip[4]);
unsigned int ip_scanbracket(char *ip_str,char *s);
unsigned int ip4_cidr(char *s,char ip[4],unsigned long *plen);
unsigned int ip4_bytestring(stralloc *ip4string,char ip[4],int plen);  

DESCRIPTION

ip4_fmt reads the char[4] IPv4 address and returns a dotted-decimal IPv4 address string 1.2.3.4.

ip4_scan reads an IPv4 address string 1.2.3.4 and converts it to the char[4] IPv4 address.

ip4_scanbracket reads an IPv4 address string enclosed in brackets [1.2.3.4] removes the brackets and calls ip4_scan on the result.

ip_scanbracket reads an IP address string enclosed in brackets [1.2.3.4] or [fe80::1], removes the brackets and calls ip4_scan or ip6_scan upon detecting an IPv6 address on the result.

ip4_cidr reads the CIDR IPv4 address string 1.2.3.4/15 determines the prefix as integer plen and calls ip4_scan. If no prefix is identified, it returns 32.

ip4_bytestring reads the IPv4 address given as char[4] while returning a 0-terminated 'bytestring' representation 1001001.... up to the given prefix length plen.  

RETURN CODES

The ip(4)* programs return the number of bytes processed. ip4_bytestring returns regative numbers on failure.  

SEE ALSO

ip6(3), socket_if(3)


 

Index

NAME
SYNTAX
DESCRIPTION
RETURN CODES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 14:55:39 GMT, December 15, 2024