📄 ipagentlib.h
字号:
/*
* Copyright (c) 2004 Greatbit Corporation. All rights reserved.
*
* This software is supplied under the terms of a license agreement
* or nondisclosure agreement with Greatbit Corporation and may not
* be copied or disclosed except in accordance with the terms of
* that agreement.
*
*
* File: ipagentLib.h
* Description:
* History: 03 Apr 2004 Who am I? Created
*
*/
#ifndef __IPAGENTLIB_H__
#define __IPAGENTLIB_H__
/* return code of functions */
#define IPAGENT_SUCCESS 0 /* Operation complate successfully */
#define IPAGENT_E_GENERIC -1 /* Generic error */
#define IPAGENT_E_OUTOFMEMORY -2 /* Unable to allocate system resources */
#define IPAGENT_E_INVALIDARG -3 /* The parameters passed is invalid */
#define IPAGENT_E_SERVERADDRESS -4 /* Invalid server address */
#define IPAGENT_E_INTERNAL -5 /* A serious error occured, should restart */
/* Events */
#define IPAGENT_EVENT_CONNECT_OK 1 /* Succefully connect to proxy server */
#define IPAGENT_EVENT_CONNECT_FAIL 2 /* Connect to proxy server failed */
#define IPAGENT_EVENT_DISCONNECT 3 /* Disconnect from proxy server */
#define IPAGENT_EVENT_REDIRECT 4 /* Proxy Server request redirect to another server */
#define IPAGENT_EVENT_CREATE_TUNNEL_OK 5 /* Create tunnel ok, upon first event of this kind, terminal can register to GK now */
#define IPAGENT_EVENT_CREATE_TUNNEL_FAIL 6 /* Cannot create tunnel, if this is the first time that terminal receive after connection, should prompt user that the proxy system cannot work because the local port was occupied by another application */
#ifdef __cplusplus
extern "C" {
#endif
/* Event handler protocol */
/* Should not block on any event */
typedef void (*IPAGENT_EVENT_HANDLER) (int nEvent);
/* function declarations */
#if defined(__STDC__) || defined(__cplusplus)
/* call ipagentProc() to start the ip agent. This is a block function, will quit upon error condition or after
ipagentStop() is called. */
extern int ipagentProc(const char * pszServerAddr, /* InnoPath server ip address */
unsigned short nServerPort, /* InnoPath server port number */
const char * pszMyAddr, /* Teminal ip address */
bool bUDPOverTCP, /* true: Single TCP, false: TCP + UDP. defualt is false */
int nReconnectTimeDelay, /* Time delay of the reconnection, in second. defualt is 10s */
int nDebugLevel, /* 0: no debug info, just error info. 1: brief debug info. 2: detailed debug info. */
IPAGENT_EVENT_HANDLER * eventHandler /* handler proc to receive IP Agent events */
);
/* Do not try to call ipagentStop multiple times, or there might be thread collision. */
extern void ipagentStop(void);
#else /* __STDC__ */
extern int ipagentProc();
extern void ipagentStop();
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* __IPAGENTLIB_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -