fetcp.h
Go to the documentation of this file.
00001 /*-------------------------------------------------------
00002 |                                                       |
00003 |                       fetcp.h                         |
00004 |                                                       |
00005 ---------------------------------------------------------
00006 
00007 Copyright (C) 2003-2012 FEIG ELECTRONIC GmbH, All Rights Reserved.
00008                                                 Lange Strasse 4
00009                                                 D-35781 Weilburg
00010                                                 Federal Republic of Germany
00011                                                 phone    : +49 6471 31090
00012                                                 fax      : +49 6471 310999
00013                                                 e-mail   : obid-support@feig.de
00014                                                 Internet : http://www.feig.de
00015                                         
00016 Author                  :       Markus Hultsch
00017 Version                 :       02.02.00 / 28.03.2012 / M. Hultsch
00018 
00019 Operating Systems       :       Windows XP / Vista / 7 / 8
00020                                                 Windows CE
00021                                                 Linux
00022                                                 Mac OS X V10.7.3 or higher
00023                                                 Android
00024 
00025 
00026 
00027 This file contains the constants, datatypes and function declartions of FETCP library
00028 */
00029 
00030 #ifndef _FETCP_INCLUDE_H
00031 #define _FETCP_INCLUDE_H
00032 
00033 
00034 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_CVI_)
00035         #ifdef FETCPDLL
00036                 #define DLL_EXT_FUNC __declspec(dllexport) __stdcall
00037         #else
00038                 #define DLL_EXT_FUNC __declspec(dllimport) __stdcall
00039         #endif
00040         #define FETCP_EXT_CALL __stdcall
00041         #define FETCP_CALL __cdecl
00042 #else
00043         #define DLL_EXT_FUNC
00044         #define CALLBACK
00045         #define FETCP_EXT_CALL
00046         #define FETCP_CALL
00047 #endif
00048 
00049 
00050 // type defines
00051 #ifdef __GNUC__
00052         #ifndef __int64
00053                 #define __int64 long long
00054         #endif
00055 #endif
00056 
00057 
00058 
00059 #ifdef __cplusplus
00060         extern "C" {
00061 #endif
00062 
00063 
00064 
00065 
00066 // #####################################################
00067 // FETCP constants
00068 // #####################################################
00069 
00070 // FETCP error codes
00071 
00072 // common errors
00073 #define FETCP_ERR_NEWSOCKET_FAILURE                     -1200
00074 #define FETCP_ERR_EMPTY_LIST                            -1201
00075 #define FETCP_ERR_POINTER_IS_NULL                       -1202
00076 #define FETCP_ERR_NO_MEMORY                                     -1203
00077 #define FETCP_ERR_SERVER_NOT_FOUND                      -1205
00078 
00079 // error while connect/disconnect the server
00080 #define FETCP_ERR_NO_CONNECTION                         -1211
00081 #define FETCP_ERR_SERVER_ADDR                           -1212   // Wenn Hostname nicht aufgelöst werden kann
00082 #define FETCP_ERR_CLOSE_CONNECTION                      -1213
00083 
00084 // handle errors
00085 #define FETCP_ERR_UNKNOWN_HND                           -1220
00086 #define FETCP_ERR_HND_IS_NULL                           -1221
00087 #define FETCP_ERR_HND_IS_NEGATIVE                       -1222
00088 #define FETCP_ERR_NO_HND_FOUND                          -1223
00089 
00090 // communication errors
00091 #define FETCP_ERR_TIMEOUT                                       -1230
00092 #define FETCP_ERR_RECEIVE_PROCESS                       -1232
00093 #define FETCP_ERR_CHANGE_SOCKET_PARA            -1236
00094 #define FETCP_ERR_TRANSMIT_PROCESS                      -1237
00095 #define FETCP_ERR_GET_CONNECTION_STATE          -1238
00096 
00097 // parameter errors
00098 #define FETCP_ERR_UNKNOWN_PARAMETER                     -1250
00099 #define FETCP_ERR_PARAMETER_OUT_OF_RANGE        -1251
00100 #define FETCP_ERR_ODD_PARAMETERSTRING           -1252
00101 #define FETCP_ERR_UNKNOWN_ERRORCODE                     -1254
00102 
00103 // communication data flow errors
00104 #define FETCP_ERR_BUFFER_OVERFLOW                       -1270
00105 
00106 
00107 
00108 // constants for dynamic load of library
00109 
00110 // miscellaneous functions
00111 #define FETCP_GET_DLL_VERSION                   1200
00112 #define FETCP_GET_ERROR_TEXT                    1201
00113 #define FETCP_GET_LAST_ERROR                    1202
00114 
00115 // functions for event notification
00116 #define FETCP_ADD_EVENT_HANDLER                 1210
00117 #define FETCP_DEL_EVENT_HANDLER                 1211
00118 
00119 // port functions
00120 #define FETCP_DETECT                                    1220
00121 #define FETCP_CONNECT                                   1221
00122 #define FETCP_DISCONNECT                                1222
00123 #define FETCP_GET_SOCKET_LIST                   1223
00124 #define FETCP_GET_SOCKET_PARA                   1224
00125 #define FETCP_SET_SOCKET_PARA                   1225
00126 #define FETCP_GET_SOCKET_HND                    1226
00127 #define FETCP_GET_SOCKET_STATE                  1227
00128 
00129 // communication function
00130 #define FETCP_TRANSCEIVE                                1230
00131 #define FETCP_TRANSMIT                                  1231
00132 #define FETCP_RECEIVE                                   1232
00133 
00134 
00135 // TCP states, returned by                                      FETCP_GetSocketStatus | FETCP_DisConnect
00136 #define FETCP_STATE_CLOSED                       1      //              X                                       X
00137 #define FETCP_STATE_LISTEN                       2      //              X                                       X
00138 #define FETCP_STATE_SYN_SENT                     3      //              X                                       X
00139 #define FETCP_STATE_SYN_RCVD                     4      //              X                                       X
00140 #define FETCP_STATE_ESTABLISHED                  5      //              X                                       X
00141 #define FETCP_STATE_FIN_WAIT1                    6      //              X                                       X
00142 #define FETCP_STATE_FIN_WAIT2                    7      //              X                                       X
00143 #define FETCP_STATE_CLOSE_WAIT                   8      //              X                                       X
00144 #define FETCP_STATE_CLOSING                      9      //              X                                       X
00145 #define FETCP_STATE_LAST_ACK                    10      //              X                                       X
00146 #define FETCP_STATE_TIME_WAIT                   11      //              X                                       -
00147 #define FETCP_STATE_DELETE_TCB                  12      //              X                                       -
00148 
00149 
00150 
00151 // defines for uiFlag in FETCP_EVENT_INIT
00152 #define FETCP_THREAD_ID         1
00153 #define FETCP_WND_HWND          2
00154 #define FETCP_CALLBACK          3
00155 
00156 // defines for uiUse in FETCP_EVENT_INIT
00157 #define FETCP_DEV_DISCONNECT_EVENT                 2
00158 
00159 
00160 
00161 // #####################################################
00162 // FETCP structures
00163 // #####################################################
00164 
00165 // structure for transfering thread-IDs, message-handles or callbacks
00166 typedef struct _FETCP_EVENT_INIT
00167 {
00168         void* pAny;             // pointer to anything, which is reflected as the first parameter 
00169                                         // in the callback function (e.g. can be used to pass the object pointer)
00170 
00171         unsigned int uiUse;             // defines the event (e.g. FETCP_xyz_EVENT)
00172         unsigned int uiMsg;             // message code used with dwThreadID and hwndWnd (e.g. WM_USER_xyz)
00173         unsigned int uiFlag;    // specifies the use of the union (e.g. FETCP_WND_HWND)
00174         union
00175         {
00176 #if defined(_MSC_VER) || defined(__BORLANDC__)
00177                 DWORD   dwThreadID;                     // for thread-ID
00178                 HWND    hwndWnd;                        // for window-handle
00179 #endif
00180                 // callback-function
00181                 void (FETCP_CALL* cbFct1)(      void* pAny,                                     // [in] pointer to anything (from struct _FETCP_EVENT_INIT)
00182                                                                         int iSocketHnd,                         // [in] socket handle of FETCP
00183                                                                         unsigned int uiUse,                     // [in] reflects the event (e.g. FETCP_xyz_EVENT)
00184                                                                         int iValue );                           // [in] a value
00185 #ifdef __cplusplus
00186         };
00187 #else
00188         }Method;
00189 #endif
00190 
00191 } FETCP_EVENT_INIT;
00192 
00193 
00194 
00195 // #####################################################
00196 // FETCP functions
00197 // #####################################################
00198 
00199 // miscellaneous functions
00200 void DLL_EXT_FUNC FETCP_GetDLLVersion( char* cVersion );
00201 int  DLL_EXT_FUNC FETCP_GetErrorText( int iErrorCode, char* cErrorText );
00202 int  DLL_EXT_FUNC FETCP_GetLastError( int iSocketHnd, int* iErrorCode, char* cErrorText );
00203 int  DLL_EXT_FUNC FETCP_Detect( char* cHostAdr, int iPortNr );
00204 int  DLL_EXT_FUNC FETCP_GetSocketState( char* cHostAdr, int iPortNr );
00205 
00206 // functions for event notification
00207 int  DLL_EXT_FUNC FETCP_AddEventHandler(int iSocketHnd, FETCP_EVENT_INIT* pInit);
00208 int  DLL_EXT_FUNC FETCP_DelEventHandler(int iSocketHnd, FETCP_EVENT_INIT* pInit);
00209 
00210 // socket functions for normal applications
00211 int  DLL_EXT_FUNC FETCP_Connect( char* cHostAdr, int iPortNr );
00212 int  DLL_EXT_FUNC FETCP_DisConnect( int iSocketHnd );
00213 
00214 // port administration functions
00215 int  DLL_EXT_FUNC FETCP_GetSocketList( int iNext );
00216 int  DLL_EXT_FUNC FETCP_GetSocketPara( int iSocketHnd, char* cPara, char* cValue );
00217 int  DLL_EXT_FUNC FETCP_SetSocketPara( int iSocketHnd, char* cPara, char* cValue );
00218 int  DLL_EXT_FUNC FETCP_GetSocketHnd( char* cHostAdr, int iPortNr );
00219 
00220 // communication function
00221 int  DLL_EXT_FUNC FETCP_Transceive( int iSocketHnd, unsigned char* cSendProt, int iSendLen, unsigned char* cRecProt, int iRecLen );
00222 int  DLL_EXT_FUNC FETCP_Transmit( int iSocketHnd, unsigned char* cSendProt, int iSendLen );
00223 int  DLL_EXT_FUNC FETCP_Receive( int iSocketHnd, unsigned char* cRecProt, int iRecLen );
00224 
00225 
00226 #undef DLL_EXT_FUNC
00227 
00228 #ifdef __cplusplus
00229 }
00230 #endif
00231 
00232 
00233 // #####################################################
00234 // typedefs of DLL-functions for explicite loading
00235 // #####################################################
00236 
00237 // miscellaneous functions
00238 typedef void (CALLBACK* LPFN_FETCP_GET_DLL_VERSION)(char*);
00239 typedef int  (CALLBACK* LPFN_FETCP_GET_ERROR_TEXT)(int, char*);
00240 typedef int  (CALLBACK* LPFN_FETCP_GET_LAST_ERROR)(int, int*, char*);
00241 
00242 // functions for event notification
00243 typedef int  (CALLBACK* LPFN_FETCP_ADD_EVENT_HANDLER)(int, FETCP_EVENT_INIT*);
00244 typedef int  (CALLBACK* LPFN_FETCP_DEL_EVENT_HANDLER)(int, FETCP_EVENT_INIT*);
00245 
00246 // port functions
00247 typedef int  (CALLBACK* LPFN_FETCP_DETECT)(char*, int);
00248 typedef int  (CALLBACK* LPFN_FETCP_CONNECT)(char*, int);
00249 typedef int  (CALLBACK* LPFN_FETCP_DISCONNECT)(int);
00250 typedef int  (CALLBACK* LPFN_FETCP_GET_SOCKET_STATE)(char*, int);
00251 typedef int  (CALLBACK* LPFN_FETCP_GET_SOCKET_LIST)(int);
00252 typedef int  (CALLBACK* LPFN_FETCP_GET_SOCKET_PARA)(int, char*, char*);
00253 typedef int  (CALLBACK* LPFN_FETCP_SET_SOCKET_PARA)(int, char*, char*);
00254 typedef int  (CALLBACK* LPFN_FETCP_GET_SOCKET_HND)(char*, int);
00255 
00256 // communication function
00257 typedef int  (CALLBACK* LPFN_FETCP_TRANSCEIVE)(int, unsigned char*, int, unsigned char*, int);
00258 typedef int  (CALLBACK* LPFN_FETCP_TRANSMIT)(int, unsigned char*, int);
00259 typedef int  (CALLBACK* LPFN_FETCP_RECEIVE)(int, unsigned char*, int);
00260 
00261 #endif // _FETCP_INCLUDE_H


rfid_drivers
Author(s): Raul Perula-Martinez
autogenerated on Thu Apr 2 2015 03:06:14