source: cheroxy/trunk/include/CRXProxy.h@ 24

Last change on this file since 24 was 24, checked in by cheese, 12 years ago

#1 change response, threading and proxy work-flow

File size: 1.7 KB
RevLine 
[18]1/**
2 * CRXProxy.h
3 */
4#ifndef __CRXPROXY_H__
5#define __CRXPROXY_H__
6
7#include "CRXException.h"
[24]8#include "CRXSocket.h"
9#include "CRXHttpMessage.h"
10#include "CRXHttpRequest.h"
11#include "CRXHttpResponse.h"
[18]12
[24]13#define ERROR_PROXY -10000
14#define ERROR_PROXY_FAILED_TO_RECEIVE_REQUEST ERROR_PROXY - 1
15#define ERROR_PROXY_FAILED_TO_SEND_REQUEST ERROR_PROXY - 2
16#define ERROR_PROXY_FAILED_TO_RECEIVE_RESPONSE ERROR_PROXY - 3
17#define ERROR_PROXY_FAILED_TO_SEND_RESPONSE ERROR_PROXY - 4
18#define ERROR_PROXY_FAILED_TO_CONNECT_TO_SERVER ERROR_PROXY - 5
19#define ERROR_PROXY_FAILED_TO_SET_RESPONSE ERROR_PROXY - 5
[18]20
[24]21typedef enum {
22 CRX_PROXY_STATUS_ERROR = -1,
23 CRX_PROXY_STATUS_IDLE,
24 CRX_PROXY_STATUS_BUSY
25} E_CRX_PROXY_STATUS;
26
[18]27class CRXProxy : public CRXException
28{
29private:
[20]30 CRXSocket mClient;
[24]31 CRXSocket mServer;
[18]32
[24]33 CRXHttpRequest mHttpRequest;
34 CRXHttpResponse mHttpResponse;
35
36 E_CRX_PROXY_STATUS mProxyStatus;
37
[18]38public:
[24]39 CRXProxy (void);
40 ~CRXProxy (void);
[18]41
[24]42 static CRXProxy * GetNewInstance (void);
43
[18]44public:
[24]45 void ReleaseInstance (void);
[20]46
[24]47 void SetClientSocket (const int aSocket);
48 void Close (void);
49
50 int GetStatus (void);
51
[20]52public:
[24]53 int Forward (void);
54
55 void SetHttpRequest (const char * aHttpRequest);
56 char * GetHttpRequest (char * aBuffer,
57 const int aBufferSize) const;
58 int GetHttpRequestLength (void) const;
59
60 void SetHttpResponse (const char * aHttpResponse);
61 char * GetHttpResponse (char * aBuffer,
62 const int aBufferSize) const;
63 int GetHttpResponseLength (void) const;
64
65 int ReceiveRequest (void);
66 int SendRequest (void);
67
68 int ReceiveResponse (void);
69 int SendResponse (void);
[18]70};
71
72#endif // #ifndef __CRXPROXY_H__
Note: See TracBrowser for help on using the repository browser.