# inetaddr.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  $RCSfile: inetaddr.h,v $
    00003                              -------------------
    00004     cvs         : $Id: inetaddr.h,v 1.14 2004/08/02 02:49:03 aquamaniac Exp $
    00005     begin       : Tue Oct 02 2002
    00006     copyright   : (C) 2002 by Martin Preuss
    00007     email       : martin@libchipcard.de
    00008
    00009  ***************************************************************************
    00010  *                                                                         *
    00011  *   This library is free software; you can redistribute it and/or         *
    00012  *   modify it under the terms of the GNU Lesser General Public            *
    00013  *   License as published by the Free Software Foundation; either          *
    00014  *   version 2.1 of the License, or (at your option) any later version.    *
    00015  *                                                                         *
    00016  *   This library is distributed in the hope that it will be useful,       *
    00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
    00019  *   Lesser General Public License for more details.                       *
    00020  *                                                                         *
    00021  *   You should have received a copy of the GNU Lesser General Public      *
    00022  *   License along with this library; if not, write to the Free Software   *
    00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
    00024  *   MA  02111-1307  USA                                                   *
    00025  *                                                                         *
    00026  ***************************************************************************/
    00027
    00033 #ifndef GWEN_INETADDR_H
    00034 #define GWEN_INETADDR_H
    00035
    00036
    00037 #include <gwenhywfar/gwenhywfarapi.h>
    00038 #include "gwenhywfar/error.h"
    00039
    00040 #ifdef __cplusplus
    00041 extern "C" {
    00042 #endif
    00043
    00044
    00055
    00058 #define GWEN_INETADDR_ERROR_TYPE "InetAddr"
    00059 #define GWEN_INETADDR_ERROR_MEMORY_FULL          1
    00060 #define GWEN_INETADDR_ERROR_BAD_ADDRESS          2
    00061 #define GWEN_INETADDR_ERROR_BUFFER_OVERFLOW      3
    00062 #define GWEN_INETADDR_ERROR_HOST_NOT_FOUND       4
    00063 #define GWEN_INETADDR_ERROR_NO_ADDRESS           5
    00064 #define GWEN_INETADDR_ERROR_NO_RECOVERY          6
    00065 #define GWEN_INETADDR_ERROR_TRY_AGAIN            7
    00066 #define GWEN_INETADDR_ERROR_UNKNOWN_DNS_ERROR    8
    00067 #define GWEN_INETADDR_ERROR_BAD_ADDRESS_FAMILY   9
    00068 #define GWEN_INETADDR_ERROR_UNSUPPORTED          10
    00069
    00075 #define GWEN_INETADDR_CAPS_AF_TCP  0x00000001
    00076 #define GWEN_INETADDR_CAPS_AF_UNIX 0x00000002
    00077
    00078 GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_InetAddr_GetCapabilities();
    00085 typedef enum {
    00087   GWEN_AddressFamilyIP=0,
    00088   /* Unix Domain Socket */
    00089   GWEN_AddressFamilyUnix
    00090 } GWEN_AddressFamily;
    00091
    00092
    00097 typedef struct GWEN_INETADDRESSSTRUCT GWEN_INETADDRESS;
    00098
    00099
    00106
    00107 GWENHYWFAR_API GWEN_INETADDRESS *GWEN_InetAddr_new(GWEN_AddressFamily af);
    00108 GWENHYWFAR_API void GWEN_InetAddr_free(GWEN_INETADDRESS *ia);
    00109 GWENHYWFAR_API GWEN_INETADDRESS *GWEN_InetAddr_dup(const GWEN_INETADDRESS *ia);
    00110
    00121
    00128 GWENHYWFAR_API GWEN_ERRORCODE GWEN_InetAddr_SetAddress(GWEN_INETADDRESS *ia,
    00129                                                        const char *addr);
    00130
    00137 GWENHYWFAR_API GWEN_ERRORCODE GWEN_InetAddr_SetName(GWEN_INETADDRESS *ia,
    00138                                                     const char *name);
    00139
    00147 GWENHYWFAR_API
    00148   GWEN_ERRORCODE GWEN_InetAddr_GetAddress(const GWEN_INETADDRESS *ia,
    00149                                           char *buffer, unsigned int bsize);
    00150
    00159 GWENHYWFAR_API
    00160   GWEN_ERRORCODE GWEN_InetAddr_GetName(const GWEN_INETADDRESS *ia,
    00161                                        char *buffer, unsigned int bsize);
    00170
    00175 GWENHYWFAR_API int GWEN_InetAddr_GetPort(const GWEN_INETADDRESS *ia);
    00176
    00183 GWENHYWFAR_API GWEN_ERRORCODE GWEN_InetAddr_SetPort(GWEN_INETADDRESS *ia,
    00184                                                     int port);
    00189 #ifdef __cplusplus
    00190 }
    00191 #endif
    00192
    00196 #endif /* GWEN_INETADDR_H */
    00197
    00198
    00199
    00200