
INET_CIDR(3)           FreeBSD Library Functions Manual           INET_CIDR(3)

NNAAMMEE
     iinneett__cciiddrr__nnttoopp, iinneett__cciiddrr__ppttoonn - network translation routines

SSYYNNOOPPSSIISS
     ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
     ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>
     ##iinncclluuddee <<nneettiinneett//iinn..hh>>
     ##iinncclluuddee <<aarrppaa//iinneett..hh>>

     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, _s_i_z_e___t _s_i_z_e)

     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)

DDEESSCCRRIIPPTTIIOONN
     These routines are used for converting addresses to and from network and
     presentation forms with CIDR (Classless Inter-Domain Routing) representa-
     tion, embedded net mask.

                     130.155.16.1/20

     iinneett__cciiddrr__nnttoopp() converts an address from network to presentation format.

     _a_f describes the type of address that is being passed in _s_r_c_.  Currently
     only AF_INET is supported.

     _s_r_c is an address in network byte order, its length is determined from
     _a_f_.

     _b_i_t_s specifies the number of bits in the netmask unless it is -1 in which
     case the CIDR representation is omitted.

     _d_s_t is a caller supplied buffer of at least _s_i_z_e bytes.

     iinneett__cciiddrr__nnttoopp() returns _d_s_t on success or NULL.  Check errno for reason.

     iinneett__cciiddrr__ppttoonn() converts and address from presentation format, with op-
     tional CIDR reperesentation, to network format.  The resulting address is
     zero filled if there were insufficint bits in _s_r_c_.

     _a_f describes the type of address that is being passed in via _s_r_c and de-
     termines the size of _d_s_t_.

     _s_r_c is an address in presentation format.

     _b_i_t_s returns the number of bits in the netmask or -1 if a CIDR represen-
     tation was not supplied.

     iinneett__cciiddrr__ppttoonn() returns 0 on succces or -1 on error.  Check errno for
     reason.  ENOENT indicates an invalid netmask.

SSEEEE AALLSSOO
     intro(2)

4th Berkeley Distribution      October 19, 1998                              1
