# UInt64Attribute

<a id="uint64attribute"></a>

# UInt64Attribute

```cpp
#include <icy/stun/attributes.h>

class UInt64Attribute
```

[Defined in src/stun/include/icy/stun/attributes.h:309](https://github.com/auscaster/icey/blob/main/src/stun/include/icy/stun/attributes.h#L309)

> **Inherits:** [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute)

Implements a STUN/TURN attribute that holds a 64-bit integer.

## List of all members

| Name | Kind | Owner |
|------|------|-------|
| [`UInt64Attribute`](#uint64attribute-1) | `function` | Declared here |
| [`UInt64Attribute`](#uint64attribute-2) | `function` | Declared here |
| [`clone`](#clone-20) | `function` | Declared here |
| [`value`](#value-2) | `function` | Declared here |
| [`setValue`](#setvalue-2) | `function` | Declared here |
| [`getBit`](#getbit-1) | `function` | Declared here |
| [`setBit`](#setbit-1) | `function` | Declared here |
| [`read`](#read-15) | `function` | Declared here |
| [`write`](#write-44) | `function` | Declared here |
| [`Size`](#size-18) | `variable` | Declared here |
| [`_bits`](#_bits-1) | `variable` | Declared here |
| [`~Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute-1) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`clone`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#clone-12) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`read`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#read-7) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`write`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#write-36) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`type`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#type-17) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`size`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#size-12) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`paddingBytes`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#paddingbytes) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`paddedBytes`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#paddedbytes) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`consumePadding`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#consumepadding) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`writePadding`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#writepadding) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`typeString`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#typestring) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`TypeID`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#typeid) | `variable` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`create`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#create-10) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`paddingBytes`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#paddingbytes-1) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`paddedBytes`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#paddedbytes-1) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`typeString`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#typestring-1) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`_type`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#_type-1) | `variable` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`_size`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#_size-3) | `variable` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute-2) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`setLength`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#setlength) | `function` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |
| [`Type`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#type-18) | `enum` | Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) |

## Inherited from [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute)

| Kind | Name | Description |
|------|------|-------------|
| `function` | [`~Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute-1) `virtual` `inline` |  |
| `function` | [`clone`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#clone-12) `virtual` | Returns a deep copy of this attribute. |
| `function` | [`read`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#read-7) `virtual` | Reads the body (not the type or size) for this type of attribute from the given buffer. |
| `function` | [`write`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#write-36) `virtual` `const` | Writes the body (not the type or size) to the given buffer. |
| `function` | [`type`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#type-17) `const` |  |
| `function` | [`size`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#size-12) `const` |  |
| `function` | [`paddingBytes`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#paddingbytes) `const` `inline` |  |
| `function` | [`paddedBytes`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#paddedbytes) `const` `inline` |  |
| `function` | [`consumePadding`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#consumepadding) `const` | Advances the reader past any 4-byte alignment padding that follows this attribute's body. |
| `function` | [`writePadding`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#writepadding) `const` | Writes zero-fill padding bytes to align this attribute to a 4-byte boundary. |
| `function` | [`typeString`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#typestring)  |  |
| `variable` | [`TypeID`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#typeid) `static` `constexpr` |  |
| `function` | [`create`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#create-10) `static` | Creates an attribute of the given wire type and body size. Returns nullptr if the type is unknown or the size is invalid. |
| `function` | [`paddingBytes`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#paddingbytes-1) `static` `inline` `constexpr` | Returns the 4-byte alignment padding required for a body of `size` bytes. |
| `function` | [`paddedBytes`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#paddedbytes-1) `static` `inline` `constexpr` | Returns the body length including 4-byte alignment padding. |
| `function` | [`typeString`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#typestring-1) `static` |  |
| `variable` | [`_type`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#_type-1)  |  |
| `variable` | [`_size`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#_size-3)  |  |
| `function` | [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute-2)  |  |
| `function` | [`setLength`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#setlength)  | Updates the stored body length. |
| `enum` | [`Type`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#type-18)  |  |

## Public Methods

| Return | Name | Description |
|--------|------|-------------|
|  | [`UInt64Attribute`](#uint64attribute-1)  |  |
|  | [`UInt64Attribute`](#uint64attribute-2)  | Copy constructor. |
| std::unique_ptr< [`Attribute`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#attribute) > | [`clone`](#clone-20) `virtual` `override` | Returns a deep copy of this attribute. |
| `uint64_t` | [`value`](#value-2) `const` `inline` |  |
| `void` | [`setValue`](#setvalue-2) `inline` | Sets the stored 64-bit value. |
| `bool` | [`getBit`](#getbit-1) `const` | Returns the state of a single bit within the stored quad-word. |
| `void` | [`setBit`](#setbit-1)  | Sets or clears a single bit within the stored quad-word. |
| `void` | [`read`](#read-15) `virtual` `override` | Reads the body (not the type or size) for this type of attribute from the given buffer. |
| `void` | [`write`](#write-44) `virtual` `const` `override` | Writes the body (not the type or size) to the given buffer. |

---

<a id="uint64attribute-1"></a>

### UInt64Attribute

```cpp
UInt64Attribute(uint16_t type)
```

[Defined in src/stun/include/icy/stun/attributes.h:313](https://github.com/auscaster/icey/blob/main/src/stun/include/icy/stun/attributes.h#L313)

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `type` | `uint16_t` | Wire type code for the concrete attribute. |

---

<a id="uint64attribute-2"></a>

### UInt64Attribute

```cpp
UInt64Attribute(const UInt64Attribute & r)
```

[Defined in src/stun/include/icy/stun/attributes.h:316](https://github.com/auscaster/icey/blob/main/src/stun/include/icy/stun/attributes.h#L316)

Copy constructor.

---

<a id="clone-20"></a>

### clone

`virtual` `override`

```cpp
virtual std::unique_ptr< Attribute > clone() override
```

[Defined in src/stun/include/icy/stun/attributes.h:319](https://github.com/auscaster/icey/blob/main/src/stun/include/icy/stun/attributes.h#L319)

Returns a deep copy of this attribute.

#### Reimplements

- [`Attribute::clone`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#clone-12)

---

<a id="value-2"></a>

### value

`const` `inline`

```cpp
inline uint64_t value() const
```

[Defined in src/stun/include/icy/stun/attributes.h:324](https://github.com/auscaster/icey/blob/main/src/stun/include/icy/stun/attributes.h#L324)

#### Returns
The stored 64-bit value.

---

<a id="setvalue-2"></a>

### setValue

`inline`

```cpp
inline void setValue(uint64_t bits)
```

[Defined in src/stun/include/icy/stun/attributes.h:328](https://github.com/auscaster/icey/blob/main/src/stun/include/icy/stun/attributes.h#L328)

Sets the stored 64-bit value.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `bits` | `uint64_t` | Value to store. |

---

<a id="getbit-1"></a>

### getBit

`const`

```cpp
bool getBit(int index) const
```

[Defined in src/stun/include/icy/stun/attributes.h:333](https://github.com/auscaster/icey/blob/main/src/stun/include/icy/stun/attributes.h#L333)

Returns the state of a single bit within the stored quad-word. 
#### Returns
true if the bit is set.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `index` | `int` | Bit position (0 = LSB, 63 = MSB). |

---

<a id="setbit-1"></a>

### setBit

```cpp
void setBit(int index, bool value)
```

[Defined in src/stun/include/icy/stun/attributes.h:338](https://github.com/auscaster/icey/blob/main/src/stun/include/icy/stun/attributes.h#L338)

Sets or clears a single bit within the stored quad-word.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `index` | `int` | Bit position (0 = LSB, 63 = MSB). |
| `value` | `bool` | true to set, false to clear. |

---

<a id="read-15"></a>

### read

`virtual` `override`

```cpp
virtual void read(BitReader & reader) override
```

[Defined in src/stun/include/icy/stun/attributes.h:340](https://github.com/auscaster/icey/blob/main/src/stun/include/icy/stun/attributes.h#L340)

Reads the body (not the type or size) for this type of attribute from the given buffer.

#### Reimplements

- [`Attribute::read`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#read-7)

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `reader` | [`BitReader`](https://auscaster.com/icey/docs/api-reference/icy-BitReader.md#bitreader) & | Source bit reader positioned at the attribute body. |

---

<a id="write-44"></a>

### write

`virtual` `const` `override`

```cpp
virtual void write(BitWriter & writer) const override
```

[Defined in src/stun/include/icy/stun/attributes.h:341](https://github.com/auscaster/icey/blob/main/src/stun/include/icy/stun/attributes.h#L341)

Writes the body (not the type or size) to the given buffer.

#### Reimplements

- [`Attribute::write`](https://auscaster.com/icey/docs/api-reference/icy-stun-Attribute.md#write-36)

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `writer` | [`BitWriter`](https://auscaster.com/icey/docs/api-reference/icy-BitWriter.md#bitwriter) & | Destination bit writer. |

## Public Static Attributes

| Return | Name | Description |
|--------|------|-------------|
| `constexpr uint16_t` | [`Size`](#size-18) `static` `constexpr` |  |

---

<a id="size-18"></a>

### Size

`static` `constexpr`

```cpp
constexpr uint16_t Size = 8
```

[Defined in src/stun/include/icy/stun/attributes.h:321](https://github.com/auscaster/icey/blob/main/src/stun/include/icy/stun/attributes.h#L321)

## Private Attributes

| Return | Name | Description |
|--------|------|-------------|
| `uint64_t` | [`_bits`](#_bits-1)  |  |

---

<a id="_bits-1"></a>

### _bits

```cpp
uint64_t _bits
```

[Defined in src/stun/include/icy/stun/attributes.h:344](https://github.com/auscaster/icey/blob/main/src/stun/include/icy/stun/attributes.h#L344)
