00001 /* 00002 * Copyright 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 _CUSTODYSIGNAL_H_ 00018 #define _CUSTODYSIGNAL_H_ 00019 00020 #include "Bundle.h" 00021 #include "BundleProtocol.h" 00022 00023 namespace dtn { 00024 00028 class CustodySignal { 00029 public: 00033 typedef BundleProtocol::custody_signal_reason_t reason_t; 00034 00038 struct data_t { 00039 u_int8_t admin_type_; 00040 u_int8_t admin_flags_; 00041 bool succeeded_; 00042 u_int8_t reason_; 00043 u_int64_t orig_frag_offset_; 00044 u_int64_t orig_frag_length_; 00045 BundleTimestamp custody_signal_tv_; 00046 BundleTimestamp orig_creation_tv_; 00047 EndpointID orig_source_eid_; 00048 }; 00049 00053 static void create_custody_signal(Bundle* bundle, 00054 const Bundle* orig_bundle, 00055 const EndpointID& source_eid, 00056 bool succeeded, 00057 reason_t reason); 00058 00062 static bool parse_custody_signal(data_t* data, 00063 const u_char* bp, u_int len); 00064 00068 static const char* reason_to_str(u_int8_t reason); 00069 }; 00070 00071 } // namespace dtn 00072 00073 #endif /* _CUSTODYSIGNAL_H_ */