summaryrefslogtreecommitdiff
path: root/man/ip4.3
blob: d6b592867f4224d958229e4da0e87eac0a02c9a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.TH qlibs: ipv4
.SH NAME
ipv4 \- IPv4 address evaluation and conversion 
.SH SYNTAX
.B #include \(dqip.h\(dq

unsigned int \fBip4_fmt\fP(char *\fIs\fR,char \fIip[4]\fR);
.br
unsigned int \fBip4_scan\fP(const char *\fIs\fR,char \fIip[4]\fR);
.br
unsigned int \fBip4_scanbracket\fP(char *\fIs\fR,char \fIip[4]\fR);
.br
unsigned int \fBip_scanbracket\fP(char *\fIip_str\fR,char *\fIs\fR);
.br
unsigned int \fBip4_cidr\fP(char *\fIs\fR,char \fIip[4]\fR,unsigned long *\fIplen\fR);
.br
unsigned int \fBip4_bytestring\fP(stralloc *\fIip4string\fR,char \fIip[4]\fR,int \fIplen\fR);
.SH DESCRIPTION
.B ip4_fmt
reads the
.I char[4] 
IPv4 address and returns a dotted-decimal IPv4 address string
.IR 1.2.3.4 .

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

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

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

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

.B ip4_bytestring
reads the IPv4 address given as
.I char[4]
while returning a 0-terminated 'bytestring' representation
.I 1001001....
up to the given prefix length
.IR plen .
.SH "RETURN CODES"
The 
.B ip(4)*
programs return the number of bytes processed.
.B ip4_bytestring
returns regative numbers on failure.
.SH "SEE ALSO"
ip6(3), socket_if(3)