inet_cidr.cat3 revision 1.1.1.1.14.1
1INET_CIDR(3)           FreeBSD Library Functions Manual           INET_CIDR(3)
2
3NNAAMMEE
4     iinneett__cciiddrr__nnttoopp, iinneett__cciiddrr__ppttoonn -- network translation routines
5
6SSYYNNOOPPSSIISS
7     ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
8     ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>
9     ##iinncclluuddee <<nneettiinneett//iinn..hh>>
10     ##iinncclluuddee <<aarrppaa//iinneett..hh>>
11
12     iinneett__cciiddrr__nnttoopp(_i_n_t _a_f, _c_o_n_s_t _v_o_i_d _*_s_r_c, _i_n_t _b_i_t_s, _c_h_a_r _*_d_s_t,
13         _s_i_z_e___t _s_i_z_e);
14
15     iinneett__cciiddrr__ppttoonn(_i_n_t _a_f, _c_o_n_s_t _c_h_a_r _*_s_r_c, _v_o_i_d _*_d_s_t, _i_n_t _*_b_i_t_s);
16
17DDEESSCCRRIIPPTTIIOONN
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.
21
22                     130.155.16.1/20
23
24     iinneett__cciiddrr__nnttoopp() converts an address from network to presentation format.
25
26     _a_f describes the type of address that is being passed in _s_r_c.  Currently
27     only AF_INET is supported.
28
29     _s_r_c is an address in network byte order, its length is determined from
30     _a_f.
31
32     _b_i_t_s specifies the number of bits in the netmask unless it is -1 in which
33     case the CIDR representation is omitted.
34
35     _d_s_t is a caller supplied buffer of at least _s_i_z_e bytes.
36
37     iinneett__cciiddrr__nnttoopp() returns _d_s_t on success or NULL.  Check errno for reason.
38
39     iinneett__cciiddrr__ppttoonn() 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 _s_r_c.
42
43     _a_f describes the type of address that is being passed in via _s_r_c and
44     determines the size of _d_s_t.
45
46     _s_r_c is an address in presentation format.
47
48     _b_i_t_s returns the number of bits in the netmask or -1 if a CIDR represen-
49     tation was not supplied.
50
51     iinneett__cciiddrr__ppttoonn() returns 0 on succces or -1 on error.  Check errno for
52     reason.  ENOENT indicates an invalid netmask.
53
54SSEEEE AALLSSOO
55     intro(2)
56
574th Berkeley Distribution      October 19, 1998      4th Berkeley Distribution
58