1 INET_CIDR(3) BSD Library Functions Manual INET_CIDR(3)
4 i
\bin
\bne
\bet
\bt_
\b_c
\bci
\bid
\bdr
\br_
\b_n
\bnt
\bto
\bop
\bp, i
\bin
\bne
\bet
\bt_
\b_c
\bci
\bid
\bdr
\br_
\b_p
\bpt
\bto
\bon
\bn - network translation routines
6 S
\bSY
\bYN
\bNO
\bOP
\bPS
\bSI
\bIS
\bS
7 #
\b#i
\bin
\bnc
\bcl
\blu
\bud
\bde
\be <
\b<s
\bsy
\bys
\bs/
\b/t
\bty
\byp
\bpe
\bes
\bs.
\b.h
\bh>
\b>
8 #
\b#i
\bin
\bnc
\bcl
\blu
\bud
\bde
\be <
\b<s
\bsy
\bys
\bs/
\b/s
\bso
\boc
\bck
\bke
\bet
\bt.
\b.h
\bh>
\b>
9 #
\b#i
\bin
\bnc
\bcl
\blu
\bud
\bde
\be <
\b<n
\bne
\bet
\bti
\bin
\bne
\bet
\bt/
\b/i
\bin
\bn.
\b.h
\bh>
\b>
10 #
\b#i
\bin
\bnc
\bcl
\blu
\bud
\bde
\be <
\b<a
\bar
\brp
\bpa
\ba/
\b/i
\bin
\bne
\bet
\bt.
\b.h
\bh>
\b>
12 i
\bin
\bne
\bet
\bt_
\b_c
\bci
\bid
\bdr
\br_
\b_n
\bnt
\bto
\bop
\bp(_
\bi_
\bn_
\bt _
\ba_
\bf, _
\bc_
\bo_
\bn_
\bs_
\bt _
\bv_
\bo_
\bi_
\bd _
\b*_
\bs_
\br_
\bc, _
\bi_
\bn_
\bt _
\bb_
\bi_
\bt_
\bs, _
\bc_
\bh_
\ba_
\br _
\b*_
\bd_
\bs_
\bt,
13 _
\bs_
\bi_
\bz_
\be_
\b__
\bt _
\bs_
\bi_
\bz_
\be);
15 i
\bin
\bne
\bet
\bt_
\b_c
\bci
\bid
\bdr
\br_
\b_p
\bpt
\bto
\bon
\bn(_
\bi_
\bn_
\bt _
\ba_
\bf, _
\bc_
\bo_
\bn_
\bs_
\bt _
\bc_
\bh_
\ba_
\br _
\b*_
\bs_
\br_
\bc, _
\bv_
\bo_
\bi_
\bd _
\b*_
\bd_
\bs_
\bt, _
\bi_
\bn_
\bt _
\b*_
\bb_
\bi_
\bt_
\bs);
17 D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
18 These routines are used for converting addresses to and from network and
19 presentation forms with CIDR (Classless Inter-Domain Routing) representa‐
20 tion, embedded net mask.
24 i
\bin
\bne
\bet
\bt_
\b_c
\bci
\bid
\bdr
\br_
\b_n
\bnt
\bto
\bop
\bp() converts an address from network to presentation format.
26 _
\ba_
\bf describes the type of address that is being passed in _
\bs_
\br_
\bc. Currently
27 only AF_INET is supported.
29 _
\bs_
\br_
\bc is an address in network byte order, its length is determined from
32 _
\bb_
\bi_
\bt_
\bs specifies the number of bits in the netmask unless it is -1 in which
33 case the CIDR representation is omitted.
35 _
\bd_
\bs_
\bt is a caller supplied buffer of at least _
\bs_
\bi_
\bz_
\be bytes.
37 i
\bin
\bne
\bet
\bt_
\b_c
\bci
\bid
\bdr
\br_
\b_n
\bnt
\bto
\bop
\bp() returns _
\bd_
\bs_
\bt on success or NULL. Check errno for reason.
39 i
\bin
\bne
\bet
\bt_
\b_c
\bci
\bid
\bdr
\br_
\b_p
\bpt
\bto
\bon
\bn() converts and address from presentation format, with
40 optional CIDR reperesentation, to network format. The resulting address
41 is zero filled if there were insufficint bits in _
\bs_
\br_
\bc.
43 _
\ba_
\bf describes the type of address that is being passed in via _
\bs_
\br_
\bc and
44 determines the size of _
\bd_
\bs_
\bt.
46 _
\bs_
\br_
\bc is an address in presentation format.
48 _
\bb_
\bi_
\bt_
\bs returns the number of bits in the netmask or -1 if a CIDR represen‐
49 tation was not supplied.
51 i
\bin
\bne
\bet
\bt_
\b_c
\bci
\bid
\bdr
\br_
\b_p
\bpt
\bto
\bon
\bn() returns 0 on succces or -1 on error. Check errno for
52 reason. ENOENT indicates an invalid netmask.
54 S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
57 4th Berkeley Distribution October 19, 1998 4th Berkeley Distribution