• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

ProtocolProbeSessionAccept.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   ProtocolProbeSessionAccept
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 ProtocolProbeSessionAccept_H_
00025 #define ProtocolProbeSessionAccept_H_
00026 
00027 #include "I_SessionAccept.h"
00028 
00029 struct ProtocolProbeSessionAcceptEnums
00030 {
00031   /// Enumeration for related groups of protocols.
00032   /// There is a child acceptor for each group which
00033   /// handles finer grained stuff.
00034   enum ProtoGroupKey {
00035     PROTO_HTTP, ///< HTTP group (0.9-1.1)
00036     PROTO_HTTP2, ///< HTTP 2 group
00037     PROTO_SPDY, ///< All SPDY versions
00038     N_PROTO_GROUPS ///< Size value.
00039   };
00040 };
00041 
00042 class ProtocolProbeSessionAccept: public SessionAccept, public ProtocolProbeSessionAcceptEnums
00043 {
00044 public:
00045   ProtocolProbeSessionAccept(): SessionAccept(NULL)
00046   {
00047     memset(endpoint, 0, sizeof(endpoint));
00048     SET_HANDLER(&ProtocolProbeSessionAccept::mainEvent);
00049   }
00050   ~ProtocolProbeSessionAccept() {}
00051 
00052   void registerEndpoint(ProtoGroupKey key, SessionAccept * ap);
00053 
00054   void accept(NetVConnection *, MIOBuffer *, IOBufferReader*);
00055 
00056 private:
00057   int mainEvent(int event, void * netvc);
00058   ProtocolProbeSessionAccept(const ProtocolProbeSessionAccept &); // disabled
00059   ProtocolProbeSessionAccept& operator =(const ProtocolProbeSessionAccept&); // disabled
00060 
00061   /** Child acceptors, index by @c ProtoGroupKey
00062 
00063       We pass on the actual accept to one of these after doing protocol sniffing.
00064       We make it one larger and leave the last entry NULL so we don't have to
00065       do range checks on the enum value.
00066    */
00067   SessionAccept * endpoint[N_PROTO_GROUPS+1];
00068 
00069 friend struct ProtocolProbeTrampoline;
00070 };
00071 
00072 #endif /* ProtocolProbeSessionAccept_H_ */

Generated by  doxygen 1.7.1