00001 /** @file 00002 00003 SSLNextProtocolAccept 00004 00005 @section license License 00006 00007 Licensed to the Apache Software Foundation (ASF) under one 00008 or more contributor license agreements. See the NOTICE file 00009 distributed with this work for additional information 00010 regarding copyright ownership. The ASF licenses this file 00011 to you under the Apache License, Version 2.0 (the 00012 "License"); you may not use this file except in compliance 00013 with the License. You may obtain a copy of the License at 00014 00015 http://www.apache.org/licenses/LICENSE-2.0 00016 00017 Unless required by applicable law or agreed to in writing, software 00018 distributed under the License is distributed on an "AS IS" BASIS, 00019 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 See the License for the specific language governing permissions and 00021 limitations under the License. 00022 */ 00023 00024 #ifndef P_SSLNextProtocolAccept_H_ 00025 #define P_SSLNextProtocolAccept_H_ 00026 00027 #include "P_Net.h" 00028 #include "P_EventSystem.h" 00029 #include "P_UnixNet.h" 00030 #include "P_SSLNetVConnection.h" 00031 #include "P_SSLNextProtocolSet.h" 00032 #include "I_IOBuffer.h" 00033 00034 class SSLNextProtocolAccept: public SessionAccept 00035 { 00036 public: 00037 SSLNextProtocolAccept(Continuation *); 00038 ~SSLNextProtocolAccept(); 00039 00040 void accept(NetVConnection *, MIOBuffer *, IOBufferReader*); 00041 00042 // Register handler as an endpoint for the specified protocol. Neither 00043 // handler nor protocol are copied, so the caller must guarantee their 00044 // lifetime is at least as long as that of the acceptor. 00045 bool registerEndpoint(const char * protocol, Continuation * handler); 00046 00047 // Unregister the handler. Returns false if this protocol is not registered 00048 // or if it is not registered for the specified handler. 00049 bool unregisterEndpoint(const char * protocol, Continuation * handler); 00050 00051 SLINK(SSLNextProtocolAccept, link); 00052 00053 private: 00054 int mainEvent(int event, void * netvc); 00055 SSLNextProtocolAccept(const SSLNextProtocolAccept &); // disabled 00056 SSLNextProtocolAccept& operator =(const SSLNextProtocolAccept&); // disabled 00057 00058 MIOBuffer * buffer; // XXX do we really need this? 00059 Continuation * endpoint; 00060 SSLNextProtocolSet protoset; 00061 00062 friend struct SSLNextProtocolTrampoline; 00063 }; 00064 00065 #endif /* P_SSLNextProtocolAccept_H_ */