paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Enumerations | Functions | Variables
attribute.c File Reference

Attribute handling functions. More...

#include <regex.h>
#include <osl.h>
#include <lopsub.h>
#include "server_cmd.lsg.h"
#include "para.h"
#include "error.h"
#include "crypt.h"
#include "string.h"
#include "afh.h"
#include "afs.h"
#include "ipc.h"
#include "sideband.h"
#include "command.h"

Enumerations

enum  attribute_table_columns { ATTCOL_BITNUM, ATTCOL_NAME, NUM_ATT_COLUMNS }
 The columns of the attribute table. More...
 

Functions

int get_attribute_bitnum_by_name (const char *att_name, unsigned char *bitnum)
 Retrieve the identifier (number) of an attribute. More...
 
void get_attribute_bitmap (const uint64_t *atts, char *buf)
 Return a binary representation of the given attribute value. More...
 
int get_attribute_text (uint64_t *atts, const char *delim, char **text)
 Get a string containing the set attributes in text form. More...
 
int attribute_check_callback (struct afs_callback_arg *aca)
 Compute the attribute bit mask and check each afs info bitmap. More...
 

Variables

const struct server_cmd_user_data lsg_server_cmd_com_lsatt_user_data = { .handler = com_lsatt }
 
const struct server_cmd_user_data lsg_server_cmd_com_addatt_user_data = { .handler = com_addatt }
 
const struct server_cmd_user_data lsg_server_cmd_com_mvatt_user_data = { .handler = com_mvatt }
 
const struct server_cmd_user_data lsg_server_cmd_com_rmatt_user_data = { .handler = com_rmatt }
 
const struct afs_table_operations attr_ops
 The attribute table stores name/bitnum pairs. More...
 

Detailed Description

Attribute handling functions.

Enumeration Type Documentation

◆ attribute_table_columns

The columns of the attribute table.

Enumerator
ATTCOL_BITNUM 

The bit number (0-63).

ATTCOL_NAME 

The name of the attribute.

NUM_ATT_COLUMNS 

Number of columns in this table.

Function Documentation

◆ get_attribute_bitnum_by_name()

int get_attribute_bitnum_by_name ( const char *  att_name,
unsigned char *  bitnum 
)

Retrieve the identifier (number) of an attribute.

Parameters
att_nameThe name of the attribute.
bitnumResult pointer.
Returns
Positive on success, negative on errors.

References osl().

Referenced by mp_is_set().

◆ get_attribute_bitmap()

void get_attribute_bitmap ( const uint64_t *  atts,
char *  buf 
)

Return a binary representation of the given attribute value.

Parameters
attsPointer to the attribute value.
bufResult.

This function prints a string of at most 64 characters plus the terminating NULL character into buf which must be provided by the caller and at least 65 bytes long. The "x" character is used for set attributes and "-" is used for unset attributes.

In practice, not all 64 attributes are defined. In this case, the function only prints N + 1 characters where N is the greatest id of a defined attribute.

◆ get_attribute_text()

int get_attribute_text ( uint64_t *  atts,
const char *  delim,
char **  text 
)

Get a string containing the set attributes in text form.

Parameters
attsThe attribute bitmap.
delimThe delimiter to separate matching attribute names.
textResult pointer.
Returns
Positive on success, negative on errors. If no attributes have been defined, *text is NULL.

◆ attribute_check_callback()

int attribute_check_callback ( struct afs_callback_arg aca)

Compute the attribute bit mask and check each afs info bitmap.

Parameters
acaThe query field of aca is ignored.

This iterates over all attributes in the attribute table and computes the logical or of 1 << b where b is the bit number of the attribute. The resulting bit mask is passed to aft_check_attributes() which performs the actual check.

Returns
Standard.
See also
aft_check_attributes().

Variable Documentation

◆ lsg_server_cmd_com_lsatt_user_data

const struct server_cmd_user_data lsg_server_cmd_com_lsatt_user_data = { .handler = com_lsatt }

◆ lsg_server_cmd_com_addatt_user_data

const struct server_cmd_user_data lsg_server_cmd_com_addatt_user_data = { .handler = com_addatt }

◆ lsg_server_cmd_com_mvatt_user_data

const struct server_cmd_user_data lsg_server_cmd_com_mvatt_user_data = { .handler = com_mvatt }

◆ lsg_server_cmd_com_rmatt_user_data

const struct server_cmd_user_data lsg_server_cmd_com_rmatt_user_data = { .handler = com_rmatt }

◆ attr_ops

const struct afs_table_operations attr_ops
Initial value:
= {
.open = attribute_open,
.close = attribute_close,
.create = attribute_create,
}

The attribute table stores name/bitnum pairs.