00001 /* 00002 * Scale Stack 00003 * 00004 * Copyright 2010 Eric Day 00005 * 00006 * Licensed under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 00024 #ifndef SCALESTACK_PROXY_CLIENT_H 00025 #define SCALESTACK_PROXY_CLIENT_H 00026 00027 #include <scalestack/network/stream.h> 00028 00029 namespace scalestack 00030 { 00031 namespace proxy 00032 { 00033 00034 class server; 00035 class server_service; 00036 00037 class client: public network::stream 00038 { 00039 public: 00040 00041 client(kernel::module& module, server_service& server_service); 00042 00046 void shutdown(void); 00047 00051 void timer_expired(void); 00052 00056 void run(void); 00057 00061 void connected(void); 00062 00066 void set_server(server* server); 00067 00071 size_t read(uint8_t* buffer, size_t size); 00072 00076 void read_eof(void); 00077 00081 void flush_write(void); 00082 00086 void continue_write(void); 00087 00088 private: 00089 00093 client(const client&); 00094 00098 client& operator=(const client&); 00099 00104 size_t _server_write(void); 00105 00106 bool _binding; 00107 bool _shutdown; 00108 bool _shutdown_write; 00109 size_t _size; 00110 uint8_t* _buffer; 00111 server* _server; 00112 server_service& _server_service; 00113 }; 00114 00115 } /* namespace proxy */ 00116 } /* namespace scalestack */ 00117 00118 #endif /* SCALESTACK_PROXY_CLIENT_H */
1.6.3