Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

inetaddr.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile: inetaddr.h,v $
00003                              -------------------
00004     cvs         : $Id: inetaddr.h,v 1.9 2003/04/21 23:33:33 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 MOD_INETADDR_H
00034 #define MOD_INETADDR_H
00035 
00036 
00037 #include "chameleon/error.h"
00038 #include <sys/types.h>
00039 #include <sys/socket.h>
00040 #include <netinet/in.h>
00041 #ifdef HAVE_ARPA_INET_H
00042 # include <arpa/inet.h>
00043 #endif
00044 
00045 
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049 
00050 
00060 
00061 #define INETADDR_ERROR_MEMORY_FULL          1
00062 #define INETADDR_ERROR_BAD_ADDRESS          2
00063 #define INETADDR_ERROR_BUFFER_OVERFLOW      3
00064 #define INETADDR_ERROR_HOST_NOT_FOUND       4
00065 #define INETADDR_ERROR_NO_ADDRESS           5
00066 #define INETADDR_ERROR_NO_RECOVERY          6
00067 #define INETADDR_ERROR_TRY_AGAIN            7
00068 #define INETADDR_ERROR_UNKNOWN_DNS_ERROR    8
00069 #define INETADDR_ERROR_BAD_ADDRESS_FAMILY   9
00070 #define INETADDR_ERROR_UNSUPPORTED          10
00071 
00075 typedef enum {
00076   AddressFamilyIP=0,
00077   AddressFamilyUnix
00078 } AddressFamily;
00079 
00080 
00084 CHIPCARD_API struct INETADDRESSSTRUCT {
00085   AddressFamily af;
00086   int size;
00087   struct sockaddr *address;
00088 };
00089 
00094 CHIPCARD_API typedef struct INETADDRESSSTRUCT INETADDRESS;
00095 
00099 CHIPCARD_API typedef INETADDRESS *INETADDRESSPTR;
00100 
00101 
00108 
00112 CHIPCARD_API ERRORCODE InetAddr_ModuleInit();
00113 
00117 CHIPCARD_API ERRORCODE InetAddr_ModuleFini();
00119 
00120 
00127 
00128 CHIPCARD_API INETADDRESS *InetAddr_new(AddressFamily af);
00129 CHIPCARD_API void InetAddr_free(INETADDRESS *ia);
00130 
00131 
00137 CHIPCARD_API ERRORCODE InetAddr_Destroy(INETADDRESSPTR ia);
00138 
00140 
00141 
00149 
00156 CHIPCARD_API ERRORCODE InetAddr_SetAddress(INETADDRESSPTR ia, const char *addr);
00157 
00164 CHIPCARD_API ERRORCODE InetAddr_SetName(INETADDRESSPTR ia, const char *name);
00165 
00173 CHIPCARD_API ERRORCODE InetAddr_GetAddress(const INETADDRESS *ia, char *buffer, int bsize);
00174 
00183 CHIPCARD_API ERRORCODE InetAddr_GetName(const INETADDRESS *ia, char *buffer, int bsize);
00185 
00192 
00197 CHIPCARD_API int InetAddr_GetPort(const INETADDRESS *ia);
00198 
00205 CHIPCARD_API ERRORCODE InetAddr_SetPort(INETADDRESSPTR ia, int port);
00207 
00208 #ifdef __cplusplus
00209 }
00210 #endif
00211 
00213 
00214 
00215 #endif // MOD_INETADDR_H
00216 
00217 
00218 
00219 

Generated on Fri Dec 3 23:10:24 2004 for libchipcard by  doxygen 1.3.9.1