The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Typedefs | Functions
uri.h File Reference
#include <freeradius-devel/util/value.h>
#include <freeradius-devel/util/sbuff.h>
+ Include dependency graph for uri.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fr_uri_escape_ctx_t
 uctx to pass to fr_uri_escape More...
 
struct  fr_uri_part_t
 Definition for a single part of a URI. More...
 

Macros

#define XLAT_URI_PART_TERMINATOR   { .name = NULL, .terminals = NULL, .safe_for = 0, .func = NULL }
 

Typedefs

typedef int(* fr_uri_escape_func_t) (fr_value_box_t *vb, void *uctx)
 A function used to escape an argument passed to an xlat. More...
 

Functions

int fr_uri_escape (fr_value_box_t *uri_vb, void *uctx)
 Escapes an individual value box that's part of a URI, advancing the pointer to uri_parts. More...
 
int fr_uri_escape_list (fr_value_box_list_t *uri, fr_uri_part_t const *uri_parts, void *uctx)
 Parse a list of value boxes representing a URI. More...
 
int fr_uri_has_scheme (fr_value_box_list_t *uri, fr_table_num_sorted_t const *schemes, size_t schemes_len, int def)
 Searches for a matching scheme in the table of schemes, using a list of value boxes representing the URI. More...
 

Data Structure Documentation

◆ fr_uri_escape_ctx_t

struct fr_uri_escape_ctx_t

uctx to pass to fr_uri_escape

Note
Should not be passed to fr_uri_escape_list. That takes the uctx to pass to the fr_uri_escape_func_t directly.

Definition at line 60 of file uri.h.

+ Collaboration diagram for fr_uri_escape_ctx_t:
Data Fields
void * uctx to pass to fr_uri_escape_func_t.
fr_uri_part_t const * uri_part Start of the uri parts array.

Will be updated as boxes are escaped.

◆ fr_uri_part_t

struct fr_uri_part_t

Definition for a single part of a URI.

Definition at line 46 of file uri.h.

+ Collaboration diagram for fr_uri_part_t:
Data Fields
size_t extra_skip How many additional characters to skip after the terminal.
fr_uri_escape_func_t func Function to use to escape tainted values.
char const * name Name of this part of the URI.
uint8_t const part_adv[UINT8_MAX+1] How many parts to advance for a specific terminal.
fr_value_box_safe_for_t safe_for What type of value is safe for this part.
fr_sbuff_term_t const * terminals Characters that mark the end of this part.

Macro Definition Documentation

◆ XLAT_URI_PART_TERMINATOR

#define XLAT_URI_PART_TERMINATOR   { .name = NULL, .terminals = NULL, .safe_for = 0, .func = NULL }

Definition at line 66 of file uri.h.

Typedef Documentation

◆ fr_uri_escape_func_t

typedef int(* fr_uri_escape_func_t) (fr_value_box_t *vb, void *uctx)

A function used to escape an argument passed to an xlat.

Parameters
[in,out]vbto escape
[in]uctxa "context" for the escaping
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 41 of file uri.h.

Function Documentation

◆ fr_uri_escape()

int fr_uri_escape ( fr_value_box_t uri_vb,
void *  uctx 
)

Escapes an individual value box that's part of a URI, advancing the pointer to uri_parts.

Note
This function has a signature compatible with fr_uri_escape_func_t.
This function may modify the type of boxes, as all boxes in the list are cast to strings before parsing.
Parameters
[in,out]uri_vbto escape
[in]uctxA fr_uri_escape_ctx_t containing the initial fr_uri_part_t and the uctx to pass to the escaping function.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 44 of file uri.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_uri_escape_list()

int fr_uri_escape_list ( fr_value_box_list_t *  uri,
fr_uri_part_t const *  uri_parts,
void *  uctx 
)

Parse a list of value boxes representing a URI.

Reads a URI from a list of value boxes and parses it according to the definition in uri_parts. Tainted values, where allowed, are escaped using the function specified for the uri part.

Note
This function may modify the type of boxes, as all boxes in the list are cast to strings before parsing.
Parameters
urito parse. A list of string type value boxes containing fragments of a URI.
uri_partsdefinition of URI structure. Should point to the start of the array of uri parts.
uctxto pass to escaping function
Returns
  • 0 on success
  • -1 on failure

Definition at line 140 of file uri.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_uri_has_scheme()

int fr_uri_has_scheme ( fr_value_box_list_t *  uri,
fr_table_num_sorted_t const *  schemes,
size_t  schemes_len,
int  def 
)

Searches for a matching scheme in the table of schemes, using a list of value boxes representing the URI.

Note
Unlikel
Parameters
urito parse. A list of string type value boxes containing fragments of a URI.
schemesTable of schemes to search.
schemes_lenNumber of schemes in the table.
defDefault scheme to use if none is found.
Returns
The matching scheme, or def if none is found.

Definition at line 167 of file uri.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: