File indexing completed on 2024-05-12 05:43:29
0001 /* 0002 Copyright (C) 2015 Volker Krause <vkrause@kde.org> 0003 0004 This program is free software; you can redistribute it and/or modify it 0005 under the terms of the GNU Library General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or (at your 0007 option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, but WITHOUT 0010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 0012 License for more details. 0013 0014 You should have received a copy of the GNU General Public License 0015 along with this program. If not, see <https://www.gnu.org/licenses/>. 0016 */ 0017 0018 #ifndef ELFNOTEENTRY_H 0019 #define ELFNOTEENTRY_H 0020 0021 #include <cstdint> 0022 0023 class ElfNoteSection; 0024 0025 /** Entries in .note sections. */ 0026 class ElfNoteEntry 0027 { 0028 public: 0029 ElfNoteEntry(const ElfNoteEntry&) = delete; 0030 virtual ~ElfNoteEntry(); 0031 0032 ElfNoteEntry& operator=(const ElfNoteEntry&) = delete; 0033 0034 /** Note type. */ 0035 virtual uint64_t type() const = 0; 0036 0037 /** Returns the section this entry belongs to. */ 0038 const ElfNoteSection *section() const; 0039 /** Size of this entry, including padding, ie. use this one to find the next one. */ 0040 virtual uint64_t size() const = 0; 0041 0042 /** Name of this note entry. */ 0043 virtual const char* name() const = 0; 0044 0045 /** Size of the description field. */ 0046 virtual uint64_t descriptionSize() const = 0; 0047 /** Data of the description field. */ 0048 virtual const char* descriptionData() const = 0; 0049 0050 /** Check if this is a GNU vendor note. */ 0051 bool isGNUVendorNote() const; 0052 0053 protected: 0054 virtual uint64_t nameSize() const = 0; 0055 explicit ElfNoteEntry(const ElfNoteSection *section); 0056 0057 private: 0058 const ElfNoteSection * const m_section; 0059 0060 }; 0061 0062 #endif // ELFNOTEENTRY_H