LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
SysvHash.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_ELF_SYSV_HASH_H
17#define LIEF_ELF_SYSV_HASH_H
18
19#include <cstdint>
20#include <vector>
21#include <ostream>
22
23#include "LIEF/Object.hpp"
24#include "LIEF/visibility.h"
25
26namespace LIEF {
27namespace ELF {
28
29class Parser;
30class Builder;
31class Binary;
32class LIEF_API SysvHash : public Object {
40
41 friend class Parser;
42 friend class Builder;
43 friend class Binary;
44
45 public:
46 SysvHash() = default;
47 SysvHash& operator=(const SysvHash& copy) = default;
48 SysvHash(const SysvHash& copy) = default;
49
50 SysvHash& operator=(SysvHash&&) = default;
51 SysvHash(SysvHash&&) = default;
52 ~SysvHash() override = default;
53 uint32_t nbucket() const {
56 return buckets_.size();
57 }
58 uint32_t nchain() const {
61 return chains_.size();
62 }
63 const std::vector<uint32_t>& buckets() const {
66 return buckets_;
67 }
68 const std::vector<uint32_t>& chains() const {
71 return chains_;
72 }
73
74 void nchain(uint32_t nb) {
75 chains_.resize(nb);
76 }
77
78 void accept(Visitor& visitor) const override;
79
80 LIEF_API friend std::ostream& operator<<(std::ostream& os, const SysvHash& sysvhash);
81
82 private:
83 std::vector<uint32_t> buckets_;
84 std::vector<uint32_t> chains_;
85};
86
87} // namepsace ELF
88} // namespace LIEF
89
90#endif
Object.hpp
LIEF::ELF::Binary
Class which represents an ELF binary.
Definition ELF/Binary.hpp:59
LIEF::ELF::Builder
Class which takes an ELF::Binary object and reconstructs a valid binary.
Definition ELF/Builder.hpp:48
LIEF::ELF::Parser
Class which parses and transforms an ELF file into a ELF::Binary object.
Definition ELF/Parser.hpp:45
LIEF::ELF::SysvHash
Class which represents the SYSV hash for the symbols resolution.
Definition SysvHash.hpp:39
LIEF::ELF::SysvHash::accept
void accept(Visitor &visitor) const override
LIEF::ELF::SysvHash::~SysvHash
~SysvHash() override=default
LIEF::ELF::SysvHash::SysvHash
SysvHash(SysvHash &&)=default
LIEF::ELF::SysvHash::nbucket
uint32_t nbucket() const
Return the number of buckets used.
Definition SysvHash.hpp:55
LIEF::ELF::SysvHash::operator=
SysvHash & operator=(const SysvHash &copy)=default
LIEF::ELF::SysvHash::nchain
void nchain(uint32_t nb)
Definition SysvHash.hpp:74
LIEF::ELF::SysvHash::SysvHash
SysvHash(const SysvHash &copy)=default
LIEF::ELF::SysvHash::nchain
uint32_t nchain() const
Return the number of chain used.
Definition SysvHash.hpp:60
LIEF::ELF::SysvHash::chains
const std::vector< uint32_t > & chains() const
Chains values.
Definition SysvHash.hpp:70
LIEF::ELF::SysvHash::SysvHash
SysvHash()=default
LIEF::ELF::SysvHash::operator<<
friend std::ostream & operator<<(std::ostream &os, const SysvHash &sysvhash)
LIEF::ELF::SysvHash::operator=
SysvHash & operator=(SysvHash &&)=default
LIEF::ELF::SysvHash::buckets
const std::vector< uint32_t > & buckets() const
Buckets values.
Definition SysvHash.hpp:65
LIEF::ELF
Namespace related to the LIEF's ELF module.
Definition Abstract/Header.hpp:28
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41