3 * Copyright (c) 2020 Project CHIP Authors
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
22 #include "Constants.h"
25 #include <support/BufBound.h>
30 /// A generic Reply record that supports data serialization
34 virtual ~ResourceRecord() {}
36 QClass GetClass() const { return QClass::IN; }
37 QType GetType() const { return mType; }
39 uint64_t GetTtl() const { return mTtl; }
40 ResourceRecord & SetTtl(uint64_t ttl)
46 /// Append the given record to the underlying output.
47 /// Updates header item count on success, does NOT update header on failure.
48 bool Append(HeaderRef & hdr, ResourceType asType, chip::BufBound & out) const;
51 /// Output the data portion of the resource record.
52 virtual bool WriteData(chip::BufBound & out) const = 0;
54 ResourceRecord(QType type, const QNamePart * names, uint16_t namesCount) : mType(type), mQNameCount(namesCount), mQName(names)
61 const uint16_t mQNameCount;
62 const QNamePart * mQName;
65 } // namespace Minimal