00001 /** @file 00002 00003 SSLNextProtocolSet 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_SSLNextProtocolSet_H_ 00025 #define P_SSLNextProtocolSet_H_ 00026 00027 #include "List.h" 00028 #include "I_Net.h" 00029 00030 class Continuation; 00031 00032 class SSLNextProtocolSet 00033 { 00034 public: 00035 SSLNextProtocolSet(); 00036 ~SSLNextProtocolSet(); 00037 00038 bool registerEndpoint(const char *, Continuation *); 00039 bool unregisterEndpoint(const char *, Continuation *); 00040 bool advertiseProtocols(const unsigned char ** out, unsigned * len) const; 00041 00042 Continuation * findEndpoint(const unsigned char *, unsigned) const; 00043 00044 struct NextProtocolEndpoint 00045 { 00046 // NOTE: the protocol and endpoint are NOT copied. The caller is 00047 // responsible for ensuring their lifetime. 00048 NextProtocolEndpoint(const char * protocol, Continuation * endpoint); 00049 ~NextProtocolEndpoint(); 00050 00051 const char * protocol; 00052 Continuation * endpoint; 00053 LINK(NextProtocolEndpoint, link); 00054 00055 typedef DLL<NextProtocolEndpoint> list_type; 00056 }; 00057 00058 private: 00059 SSLNextProtocolSet(const SSLNextProtocolSet&); // disabled 00060 SSLNextProtocolSet& operator=(const SSLNextProtocolSet&); // disabled 00061 00062 mutable unsigned char * npn; 00063 mutable size_t npnsz; 00064 00065 NextProtocolEndpoint::list_type endpoints; 00066 }; 00067 00068 #endif /* P_SSLNextProtocolSet_H_ */