Tor 0.4.9.0-alpha-dev
Macros | Functions
nodefamily.h File Reference

Header file for nodefamily.c. More...

#include "lib/malloc/malloc.h"
#include <stdbool.h>

Go to the source code of this file.

Macros

#define NF_WARN_MALFORMED   (1u<<0)
 
#define NF_REJECT_MALFORMED   (1u<<1)
 
#define nodefamily_free(family)    FREE_AND_NULL(nodefamily_t, nodefamily_free_, (family))
 

Functions

nodefamily_tnodefamily_parse (const char *s, const uint8_t *rsa_id_self, unsigned flags)
 
nodefamily_tnodefamily_from_members (const struct smartlist_t *members, const uint8_t *rsa_id_self, unsigned flags, smartlist_t *unrecognized_out)
 
void nodefamily_free_ (nodefamily_t *family)
 
bool nodefamily_contains_rsa_id (const nodefamily_t *family, const uint8_t *rsa_id)
 
bool nodefamily_contains_nickname (const nodefamily_t *family, const char *name)
 
bool nodefamily_contains_node (const nodefamily_t *family, const struct node_t *node)
 
void nodefamily_add_nodes_to_smartlist (const nodefamily_t *family, struct smartlist_t *out)
 
char * nodefamily_format (const nodefamily_t *family)
 
char * nodefamily_canonicalize (const char *s, const uint8_t *rsa_id_self, unsigned flags)
 
void nodefamily_free_all (void)
 

Detailed Description

Header file for nodefamily.c.

Definition in file nodefamily.h.

Macro Definition Documentation

◆ NF_REJECT_MALFORMED

#define NF_REJECT_MALFORMED   (1u<<1)

Definition at line 23 of file nodefamily.h.

◆ NF_WARN_MALFORMED

#define NF_WARN_MALFORMED   (1u<<0)

Definition at line 22 of file nodefamily.h.

◆ nodefamily_free

#define nodefamily_free (   family)     FREE_AND_NULL(nodefamily_t, nodefamily_free_, (family))

Definition at line 33 of file nodefamily.h.

Function Documentation

◆ nodefamily_add_nodes_to_smartlist()

void nodefamily_add_nodes_to_smartlist ( const nodefamily_t family,
smartlist_t out 
)

Look up every entry in family, and add add the corresponding node_t to out.

Definition at line 342 of file nodefamily.c.

◆ nodefamily_canonicalize()

char * nodefamily_canonicalize ( const char *  s,
const uint8_t *  rsa_id_self,
unsigned  flags 
)

Canonicalize the family list s, returning a newly allocated string.

The canonicalization rules are fully specified in dir-spec.txt, but, briefly: $hexid entries are put in caps, $hexid[=~]foo entries are truncated, nicknames are put into lowercase, unrecognized entries are left alone, and everything is sorted.

Definition at line 111 of file nodefamily.c.

◆ nodefamily_contains_nickname()

bool nodefamily_contains_nickname ( const nodefamily_t family,
const char *  name 
)

Return true iff family contains the nickname name.

Definition at line 304 of file nodefamily.c.

Referenced by nodefamily_contains_node().

◆ nodefamily_contains_rsa_id()

bool nodefamily_contains_rsa_id ( const nodefamily_t family,
const uint8_t *  rsa_id 
)

Return true iff family contains the SHA1 RSA1024 identity rsa_id.

Definition at line 283 of file nodefamily.c.

Referenced by nodefamily_contains_node().

◆ nodefamily_format()

char * nodefamily_format ( const nodefamily_t family)

Encode family as a space-separated string.

Definition at line 374 of file nodefamily.c.

◆ nodefamily_free_()

void nodefamily_free_ ( nodefamily_t family)

Drop our reference to family, freeing it if there are no more references.

Definition at line 265 of file nodefamily.c.

◆ nodefamily_free_all()

void nodefamily_free_all ( void  )

Free all storage held in the nodefamily map.

Definition at line 413 of file nodefamily.c.