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