actf 0.0.1
An acute CTF reader
Loading...
Searching...
No Matches
/home/adwe/code/actf/flags.h File Reference

Bit map flags related methods. More...

#include <stdint.h>
#include <unistd.h>
#include "types.h"

Go to the source code of this file.

Typedefs

typedef struct actf_flags actf_flags
 Flags map names to bit index range sets.

Functions

const char * actf_flags_find (const actf_flags *f, uint64_t val, actf_it *it)
 Find the next flag name matching the provided value.
const char * actf_flags_find_first_match (const actf_flags *f, uint64_t val)
 Find the first flag name matching the provided value.

Detailed Description

Bit map flags related methods.

Function Documentation

◆ actf_flags_find()

const char * actf_flags_find ( const actf_flags * f,
uint64_t val,
actf_it * it )

Find the next flag name matching the provided value.

A value can be mapped to several flags, so to read them all out, you should call actf_flags_find() repeatedly with the same iterator until NULL is returned.

Parameters
fthe flags
valthe value
itthe iterator to use, it must be zero initialized on the first call and then unmodified for subsequent calls.
Returns
the flag name or NULL if no more matches exist

◆ actf_flags_find_first_match()

const char * actf_flags_find_first_match ( const actf_flags * f,
uint64_t val )

Find the first flag name matching the provided value.

Convenience function for when you only care about the first matching name.

Parameters
fthe flags
valthe value
Returns
the flag name or NULL if no matches exist