gwenhywfar  4.3.3
inetaddr.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile$
00003                              -------------------
00004     cvs         : $Id$
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 uint32_t GWEN_InetAddr_GetCapabilities(void);
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 int GWEN_InetAddr_SetAddress(GWEN_INETADDRESS *ia, const char *addr);
00129 
00136 GWENHYWFAR_API int GWEN_InetAddr_SetName(GWEN_INETADDRESS *ia, const char *name);
00137 
00145 GWENHYWFAR_API
00146   int GWEN_InetAddr_GetAddress(const GWEN_INETADDRESS *ia,
00147                                           char *buffer, unsigned int bsize);
00148 
00157 GWENHYWFAR_API
00158   int GWEN_InetAddr_GetName(const GWEN_INETADDRESS *ia,
00159                                        char *buffer, unsigned int bsize);
00168 
00173 GWENHYWFAR_API int GWEN_InetAddr_GetPort(const GWEN_INETADDRESS *ia);
00174 
00181 GWENHYWFAR_API int GWEN_InetAddr_SetPort(GWEN_INETADDRESS *ia,
00182                                          int port);
00187 #ifdef __cplusplus
00188 }
00189 #endif
00190 
00194 #endif /* GWEN_INETADDR_H */
00195 
00196 
00197 
00198