"Fossies" - the Fresh Open Source Software Archive

Member "udns-0.4/udns_XtoX.c" (5 Jul 2011, 1496 Bytes) of package /linux/misc/dns/udns-0.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "udns_XtoX.c" see the Fossies "Dox" file reference documentation.

    1 /* udns_XtoX.c
    2    udns_ntop() and udns_pton() routines, which are either
    3      - wrappers for inet_ntop() and inet_pton() or
    4      - reimplementations of those routines.
    5 
    6    Copyright (C) 2005  Michael Tokarev <mjt@corpit.ru>
    7    This file is part of UDNS library, an async DNS stub resolver.
    8 
    9    This library is free software; you can redistribute it and/or
   10    modify it under the terms of the GNU Lesser General Public
   11    License as published by the Free Software Foundation; either
   12    version 2.1 of the License, or (at your option) any later version.
   13 
   14    This library is distributed in the hope that it will be useful,
   15    but WITHOUT ANY WARRANTY; without even the implied warranty of
   16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   17    Lesser General Public License for more details.
   18 
   19    You should have received a copy of the GNU Lesser General Public
   20    License along with this library, in file named COPYING.LGPL; if not,
   21    write to the Free Software Foundation, Inc., 59 Temple Place,
   22    Suite 330, Boston, MA  02111-1307  USA
   23 
   24  */
   25 
   26 #ifdef HAVE_CONFIG_H
   27 # include "config.h"
   28 #endif
   29 #include "udns.h"
   30 
   31 #ifdef HAVE_INET_PTON_NTOP
   32 
   33 #include <sys/types.h>
   34 #include <sys/socket.h>
   35 #include <arpa/inet.h>
   36 
   37 const char *dns_ntop(int af, const void *src, char *dst, int size) {
   38   return inet_ntop(af, src, dst, size);
   39 }
   40 
   41 int dns_pton(int af, const char *src, void *dst) {
   42   return inet_pton(af, src, dst);
   43 }
   44 
   45 #else
   46 
   47 #define inet_XtoX_prefix udns_
   48 #include "inet_XtoX.c"
   49 
   50 #endif