libsqsh v1.5.1
Loading...
Searching...
No Matches
SqshXattrIterator Struct Reference

An iterator over extended attributes. More...

#include <sqsh_xattr_private.h>

Public Member Functions

SQSH_NO_UNUSED struct SqshXattrIteratorsqsh_xattr_iterator_new (const struct SqshFile *file, int *err)
 Allocates and initializes a new xattr iterator.
 
SQSH_NO_UNUSED bool sqsh_xattr_iterator_next (struct SqshXattrIterator *iterator, int *err)
 Advances the iterator to the next xattr.
 
uint16_t sqsh_xattr_iterator_type (const struct SqshXattrIterator *iterator)
 Retrieves the type of the current xattr.
 
bool sqsh_xattr_iterator_is_indirect (const struct SqshXattrIterator *iterator)
 Checks if the current xattr is indirect.
 
const char * sqsh_xattr_iterator_prefix (const struct SqshXattrIterator *iterator)
 Retrieves the prefix of the current xattr.
 
uint16_t sqsh_xattr_iterator_prefix_size (const struct SqshXattrIterator *iterator)
 Retrieves the size of the prefix of the current xattr.
 
const char * sqsh_xattr_iterator_name (const struct SqshXattrIterator *iterator)
 Retrieves the name of the current xattr excluding the prefix.
 
uint16_t sqsh_xattr_iterator_name_size (const struct SqshXattrIterator *iterator)
 Retrieves the size of the name of the current xattr.
 
SQSH_NO_UNUSED int sqsh_xattr_iterator_lookup (struct SqshXattrIterator *iterator, const char *name)
 Looks up an xattr by name.
 
SQSH_NO_UNUSED int sqsh_xattr_iterator_fullname_cmp (const struct SqshXattrIterator *iterator, const char *name)
 Compares the full name of the current xattr with a given 0-terminated name.
 
SQSH_NO_UNUSED char * sqsh_xattr_iterator_fullname_dup (const struct SqshXattrIterator *iterator)
 creates a heap allocated copy of the full name of the current entry.
 
SQSH_NO_UNUSED char * sqsh_xattr_iterator_value_dup (const struct SqshXattrIterator *iterator)
 creates a heap allocated copy of the value of the current entry.
 
const char * sqsh_xattr_iterator_value (const struct SqshXattrIterator *iterator)
 Retrieves the value of the current xattr.
 
uint32_t sqsh_xattr_iterator_value_size2 (const struct SqshXattrIterator *iterator)
 Retrieves the size of the value of the current xattr.
 
uint16_t sqsh_xattr_iterator_value_size (const struct SqshXattrIterator *iterator)
 Retrieves the size of the value of the current xattr.
 
int sqsh_xattr_iterator_free (struct SqshXattrIterator *iterator)
 Frees the resources used by an xattr iterator.
 

Detailed Description

An iterator over extended attributes.

Definition at line 52 of file sqsh_xattr_private.h.

Member Function Documentation

◆ sqsh_xattr_iterator_free()

int sqsh_xattr_iterator_free ( struct SqshXattrIterator * iterator)

Frees the resources used by an xattr iterator.

Parameters
[in]iteratorThe iterator to free.
Returns
0 on success, a negative value on error.

◆ sqsh_xattr_iterator_fullname_cmp()

SQSH_NO_UNUSED int sqsh_xattr_iterator_fullname_cmp ( const struct SqshXattrIterator * iterator,
const char * name )

Compares the full name of the current xattr with a given 0-terminated name.

Parameters
[in]iteratorThe iterator to use.
[in]nameThe name to compare with.
Returns
0 if the names match, a negative value if the current xattr's name is less than the given name, a positive value if the current xattr's name is greater than the given name.

◆ sqsh_xattr_iterator_fullname_dup()

SQSH_NO_UNUSED char * sqsh_xattr_iterator_fullname_dup ( const struct SqshXattrIterator * iterator)

creates a heap allocated copy of the full name of the current entry.

The caller is responsible for calling free() on the returned pointer.

The returned string is 0 terminated.

Parameters
[in]iteratorThe iterator to use.
Returns
The full name of the current xattr on success, NULL if the allocation fails.

◆ sqsh_xattr_iterator_is_indirect()

bool sqsh_xattr_iterator_is_indirect ( const struct SqshXattrIterator * iterator)

Checks if the current xattr is indirect.

Parameters
[in]iteratorThe iterator to use.
Returns
true if the xattr is indirect, false otherwise.

◆ sqsh_xattr_iterator_lookup()

SQSH_NO_UNUSED int sqsh_xattr_iterator_lookup ( struct SqshXattrIterator * iterator,
const char * name )

Looks up an xattr by name.

Parameters
[in]iteratorThe iterator to use.
[in]nameThe name to lookup
Returns
0 if the xattr was found, a negative value otherwise.

◆ sqsh_xattr_iterator_name()

const char * sqsh_xattr_iterator_name ( const struct SqshXattrIterator * iterator)

Retrieves the name of the current xattr excluding the prefix.

The returned pointer is allocated internally and only valid until the next call to sqsh_xattr_iterator_next(). It must not be freed. The string is not 0 terminated. Use sqsh_xattr_iterator_name_size() to get the size of the name.

Parameters
[in]iteratorThe iterator to use.
Returns
The name of the current xattr.

◆ sqsh_xattr_iterator_name_size()

uint16_t sqsh_xattr_iterator_name_size ( const struct SqshXattrIterator * iterator)

Retrieves the size of the name of the current xattr.

Parameters
[in]iteratorThe iterator to use.
Returns
The size of the name of the current xattr.

◆ sqsh_xattr_iterator_new()

SQSH_NO_UNUSED struct SqshXattrIterator * sqsh_xattr_iterator_new ( const struct SqshFile * file,
int * err )

Allocates and initializes a new xattr iterator.

Parameters
[in]fileThe file context to iterate through xattrs.
[out]errPointer to an int where the error code will be stored.
Returns
The new iterator on success, NULL on error.

◆ sqsh_xattr_iterator_next()

SQSH_NO_UNUSED bool sqsh_xattr_iterator_next ( struct SqshXattrIterator * iterator,
int * err )

Advances the iterator to the next xattr.

Parameters
[in,out]iteratorThe iterator to advance.
[out]errPointer to an int where the error code will be stored.
Return values
trueWhen the iterator was advanced.
falseWhen the end of the xattrs list was reached or an error occured.

◆ sqsh_xattr_iterator_prefix()

const char * sqsh_xattr_iterator_prefix ( const struct SqshXattrIterator * iterator)

Retrieves the prefix of the current xattr.

There are three possible prefixes that can be returned:

  • "user."
  • "trusted."
  • "security."

The returned pointer is staticly allocated and must not be freed.

Parameters
[in]iteratorThe iterator to use.
Returns
The null terminated prefix of the current xattr. The returned pointer is staticly allocated and must not be freed.

◆ sqsh_xattr_iterator_prefix_size()

uint16_t sqsh_xattr_iterator_prefix_size ( const struct SqshXattrIterator * iterator)

Retrieves the size of the prefix of the current xattr.

Parameters
[in]iteratorThe iterator to use.
Returns
The size of the prefix of the current xattr.

◆ sqsh_xattr_iterator_type()

uint16_t sqsh_xattr_iterator_type ( const struct SqshXattrIterator * iterator)

Retrieves the type of the current xattr.

Parameters
[in]iteratorThe iterator to use.
Returns
The type of the current xattr.

◆ sqsh_xattr_iterator_value()

const char * sqsh_xattr_iterator_value ( const struct SqshXattrIterator * iterator)

Retrieves the value of the current xattr.

The returned pointer is allocated internally and only valid until the next call to sqsh_xattr_iterator_next(). It must not be freed. The string is not 0 terminated. Use sqsh_xattr_iterator_value_size() to get the size of the value.

Parameters
[in]iteratorThe iterator to use.
Returns
The value of the current xattr. The returned pointer is allocated internally and only valid until the next call to sqsh_xattr_iterator_next(). It must not be freed.

◆ sqsh_xattr_iterator_value_dup()

SQSH_NO_UNUSED char * sqsh_xattr_iterator_value_dup ( const struct SqshXattrIterator * iterator)

creates a heap allocated copy of the value of the current entry.

The caller is responsible for calling free() on the returned pointer.

The returned string is 0 terminated.

Parameters
[in]iteratorThe iterator to use.
Returns
The value of the current xattr on success, NULL if the allocation fails.

◆ sqsh_xattr_iterator_value_size()

uint16_t sqsh_xattr_iterator_value_size ( const struct SqshXattrIterator * iterator)

Retrieves the size of the value of the current xattr.

Deprecated
Since 1.3.0. Use sqsh_xattr_iterator_value_size2() instead.
Parameters
[in]iteratorThe iterator to use.
Returns
The size of the value of the current xattr.

◆ sqsh_xattr_iterator_value_size2()

uint32_t sqsh_xattr_iterator_value_size2 ( const struct SqshXattrIterator * iterator)

Retrieves the size of the value of the current xattr.

Parameters
[in]iteratorThe iterator to use.
Returns
The size of the value of the current xattr.

The documentation for this struct was generated from the following files: