OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_TOOLS_FLIP_SERVER_SM_INTERFACE_H_ | 5 #ifndef NET_TOOLS_FLIP_SERVER_SM_INTERFACE_H_ |
6 #define NET_TOOLS_FLIP_SERVER_SM_INTERFACE_H_ | 6 #define NET_TOOLS_FLIP_SERVER_SM_INTERFACE_H_ |
7 | 7 |
8 // State Machine Interfaces | 8 // State Machine Interfaces |
9 | 9 |
| 10 #include <stddef.h> |
| 11 #include <stdint.h> |
| 12 |
10 #include <string> | 13 #include <string> |
11 | 14 |
12 #include "net/tools/balsa/balsa_headers.h" | 15 #include "net/tools/balsa/balsa_headers.h" |
13 | 16 |
14 namespace net { | 17 namespace net { |
15 | 18 |
16 class EpollServer; | 19 class EpollServer; |
17 class SMConnectionPoolInterface; | 20 class SMConnectionPoolInterface; |
18 class SMConnection; | 21 class SMConnection; |
19 | 22 |
20 class SMInterface { | 23 class SMInterface { |
21 public: | 24 public: |
22 virtual void InitSMInterface(SMInterface* sm_other_interface, | 25 virtual void InitSMInterface(SMInterface* sm_other_interface, |
23 int32 server_idx) = 0; | 26 int32_t server_idx) = 0; |
24 virtual void InitSMConnection(SMConnectionPoolInterface* connection_pool, | 27 virtual void InitSMConnection(SMConnectionPoolInterface* connection_pool, |
25 SMInterface* sm_interface, | 28 SMInterface* sm_interface, |
26 EpollServer* epoll_server, | 29 EpollServer* epoll_server, |
27 int fd, | 30 int fd, |
28 std::string server_ip, | 31 std::string server_ip, |
29 std::string server_port, | 32 std::string server_port, |
30 std::string remote_ip, | 33 std::string remote_ip, |
31 bool use_ssl) = 0; | 34 bool use_ssl) = 0; |
32 virtual size_t ProcessReadInput(const char* data, size_t len) = 0; | 35 virtual size_t ProcessReadInput(const char* data, size_t len) = 0; |
33 virtual size_t ProcessWriteInput(const char* data, size_t len) = 0; | 36 virtual size_t ProcessWriteInput(const char* data, size_t len) = 0; |
34 virtual void SetStreamID(uint32 stream_id) = 0; | 37 virtual void SetStreamID(uint32_t stream_id) = 0; |
35 virtual bool MessageFullyRead() const = 0; | 38 virtual bool MessageFullyRead() const = 0; |
36 virtual bool Error() const = 0; | 39 virtual bool Error() const = 0; |
37 virtual const char* ErrorAsString() const = 0; | 40 virtual const char* ErrorAsString() const = 0; |
38 virtual void Reset() = 0; | 41 virtual void Reset() = 0; |
39 virtual void ResetForNewInterface(int32 server_idx) = 0; | 42 virtual void ResetForNewInterface(int32_t server_idx) = 0; |
40 // ResetForNewConnection is used for interfaces which control SMConnection | 43 // ResetForNewConnection is used for interfaces which control SMConnection |
41 // objects. When called an interface may put its connection object into | 44 // objects. When called an interface may put its connection object into |
42 // a reusable instance pool. Currently this is what the HttpSM interface | 45 // a reusable instance pool. Currently this is what the HttpSM interface |
43 // does. | 46 // does. |
44 virtual void ResetForNewConnection() = 0; | 47 virtual void ResetForNewConnection() = 0; |
45 virtual void Cleanup() = 0; | 48 virtual void Cleanup() = 0; |
46 | 49 |
47 virtual int PostAcceptHook() = 0; | 50 virtual int PostAcceptHook() = 0; |
48 | 51 |
49 virtual void NewStream(uint32 stream_id, | 52 virtual void NewStream(uint32_t stream_id, |
50 uint32 priority, | 53 uint32_t priority, |
51 const std::string& filename) = 0; | 54 const std::string& filename) = 0; |
52 virtual void SendEOF(uint32 stream_id) = 0; | 55 virtual void SendEOF(uint32_t stream_id) = 0; |
53 virtual void SendErrorNotFound(uint32 stream_id) = 0; | 56 virtual void SendErrorNotFound(uint32_t stream_id) = 0; |
54 virtual size_t SendSynStream(uint32 stream_id, | 57 virtual size_t SendSynStream(uint32_t stream_id, |
55 const BalsaHeaders& headers) = 0; | 58 const BalsaHeaders& headers) = 0; |
56 virtual size_t SendSynReply(uint32 stream_id, | 59 virtual size_t SendSynReply(uint32_t stream_id, |
57 const BalsaHeaders& headers) = 0; | 60 const BalsaHeaders& headers) = 0; |
58 virtual void SendDataFrame(uint32 stream_id, | 61 virtual void SendDataFrame(uint32_t stream_id, |
59 const char* data, | 62 const char* data, |
60 int64 len, | 63 int64_t len, |
61 uint32 flags, | 64 uint32_t flags, |
62 bool compress) = 0; | 65 bool compress) = 0; |
63 virtual void GetOutput() = 0; | 66 virtual void GetOutput() = 0; |
64 virtual void set_is_request() = 0; | 67 virtual void set_is_request() = 0; |
65 | 68 |
66 virtual ~SMInterface() {} | 69 virtual ~SMInterface() {} |
67 }; | 70 }; |
68 | 71 |
69 class SMConnectionInterface { | 72 class SMConnectionInterface { |
70 public: | 73 public: |
71 virtual ~SMConnectionInterface() {} | 74 virtual ~SMConnectionInterface() {} |
72 virtual void ReadyToSend() = 0; | 75 virtual void ReadyToSend() = 0; |
73 virtual EpollServer* epoll_server() = 0; | 76 virtual EpollServer* epoll_server() = 0; |
74 }; | 77 }; |
75 | 78 |
76 class SMConnectionPoolInterface { | 79 class SMConnectionPoolInterface { |
77 public: | 80 public: |
78 virtual ~SMConnectionPoolInterface() {} | 81 virtual ~SMConnectionPoolInterface() {} |
79 virtual void SMConnectionDone(SMConnection* connection) = 0; | 82 virtual void SMConnectionDone(SMConnection* connection) = 0; |
80 }; | 83 }; |
81 | 84 |
82 } // namespace net | 85 } // namespace net |
83 | 86 |
84 #endif // NET_TOOLS_FLIP_SERVER_SM_INTERFACE_H_ | 87 #endif // NET_TOOLS_FLIP_SERVER_SM_INTERFACE_H_ |
OLD | NEW |