00001 /* 00002 * Copyright 2005-2006 Intel Corporation 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef _SCHEME_H_ 00018 #define _SCHEME_H_ 00019 00020 #include <string> 00021 00022 #include <oasys/util/URI.h> 00023 #include "EndpointID.h" 00024 00025 namespace dtn { 00026 00027 typedef oasys::URI URI; 00028 00029 class EndpointID; 00030 class EndpointIDPattern; 00031 00037 class Scheme { 00038 public: 00042 virtual ~Scheme(); 00043 00051 virtual bool validate(const URI& uri, bool is_pattern = false) = 0; 00052 00057 virtual bool match(const EndpointIDPattern& pattern, 00058 const EndpointID& eid) = 0; 00059 00067 virtual bool append_service_tag(URI* uri, const char* tag) 00068 { 00069 (void)uri; 00070 (void)tag; 00071 return false; 00072 } 00073 00081 virtual bool append_service_wildcard(URI* uri) 00082 { 00083 (void)uri; 00084 return false; 00085 } 00086 00094 virtual bool remove_service_tag(URI* uri) 00095 { 00096 (void)uri; 00097 return false; 00098 } 00099 00104 typedef EndpointID::singleton_info_t singleton_info_t; 00105 00109 virtual singleton_info_t is_singleton(const URI& uri) = 0; 00110 }; 00111 00112 } 00113 00114 #endif /* _SCHEME_H_ */