Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
md_util.h File Reference
#include <stdio.h>
#include <apr_file_io.h>
Include dependency graph for md_util.h:

Go to the source code of this file.

Data Structures

struct  md_data_t
 

Macros

#define MD_DATA_CWRAP(d, buffer)   md_data_t d = { buffer, sizeof(buffer) }
 

Typedefs

typedef apr_status_t md_util_action (void *baton, apr_pool_t *p, apr_pool_t *ptemp)
 
typedef apr_status_t md_util_vaction (void *baton, apr_pool_t *p, apr_pool_t *ptemp, va_list ap)
 
typedef struct md_data_t md_data_t
 
typedef apr_status_t md_util_file_cb (void *baton, struct apr_file_t *f, apr_pool_t *p)
 
typedef apr_status_t md_util_fdo_cb (void *baton, apr_pool_t *p, apr_pool_t *ptemp, const char *dir, const char *name, apr_filetype_e ftype)
 
typedef apr_status_t md_util_try_fn (void *baton, int i)
 

Functions

apr_status_t md_util_pool_do (md_util_action *cb, void *baton, apr_pool_t *p)
 
apr_status_t md_util_pool_vdo (md_util_vaction *cb, void *baton, apr_pool_t *p,...)
 
md_data_tmd_data_make (apr_pool_t *p, apr_size_t len)
 
md_data_tmd_data_create (apr_pool_t *p, const char *data, apr_size_t len)
 
void md_data_assign_pcopy (md_data_t *dest, const md_data_t *src, apr_pool_t *p)
 
apr_status_t md_data_to_hex (const char **phex, char separator, apr_pool_t *p, const md_data_t *data)
 
int md_array_remove (struct apr_array_header_t *a, void *elem)
 
int md_array_remove_at (struct apr_array_header_t *a, int idx)
 
char * md_util_str_tolower (char *s)
 
int md_array_is_empty (const struct apr_array_header_t *array)
 
int md_array_str_index (const struct apr_array_header_t *array, const char *s, int start, int case_sensitive)
 
int md_array_str_eq (const struct apr_array_header_t *a1, const struct apr_array_header_t *a2, int case_sensitive)
 
struct apr_array_header_tmd_array_str_clone (apr_pool_t *p, struct apr_array_header_t *array)
 
struct apr_array_header_tmd_array_str_compact (apr_pool_t *p, struct apr_array_header_t *src, int case_sensitive)
 
struct apr_array_header_tmd_array_str_remove (apr_pool_t *p, struct apr_array_header_t *src, const char *exclude, int case_sensitive)
 
int md_array_str_add_missing (struct apr_array_header_t *dest, struct apr_array_header_t *src, int case_sensitive)
 
apr_status_t md_util_exec (apr_pool_t *p, const char *cmd, const char *const *argv, int *exit_code)
 
int md_dns_is_name (apr_pool_t *p, const char *domain, int need_fqdn)
 
int md_dns_is_wildcard (apr_pool_t *p, const char *domain)
 
int md_dns_matches (const char *pattern, const char *domain)
 
struct apr_array_header_tmd_dns_make_minimal (apr_pool_t *p, struct apr_array_header_t *domains)
 
int md_dns_domains_match (const apr_array_header_t *domains, const char *name)
 
apr_status_t md_util_fopen (FILE **pf, const char *fn, const char *mode)
 
apr_status_t md_util_fcreatex (struct apr_file_t **pf, const char *fn, apr_fileperms_t perms, apr_pool_t *p)
 
apr_status_t md_util_path_merge (const char **ppath, apr_pool_t *p,...)
 
apr_status_t md_util_is_dir (const char *path, apr_pool_t *pool)
 
apr_status_t md_util_is_file (const char *path, apr_pool_t *pool)
 
int md_file_exists (const char *fname, apr_pool_t *p)
 
apr_status_t md_util_freplace (const char *fpath, apr_fileperms_t perms, apr_pool_t *p, md_util_file_cb *write, void *baton)
 
apr_status_t md_util_rm_recursive (const char *fpath, apr_pool_t *p, int max_level)
 
apr_status_t md_util_files_do (md_util_fdo_cb *cb, void *baton, apr_pool_t *p, const char *path,...)
 
apr_status_t md_util_tree_do (md_util_fdo_cb *cb, void *baton, apr_pool_t *p, const char *path, int follow_links)
 
apr_status_t md_util_ftree_remove (const char *path, apr_pool_t *p)
 
apr_status_t md_text_fread8k (const char **ptext, apr_pool_t *p, const char *fpath)
 
apr_status_t md_text_fcreatex (const char *fpath, apr_fileperms_t perms, apr_pool_t *p, const char *text)
 
apr_status_t md_text_freplace (const char *fpath, apr_fileperms_t perms, apr_pool_t *p, const char *text)
 
const char * md_util_base64url_encode (const md_data_t *data, apr_pool_t *pool)
 
apr_size_t md_util_base64url_decode (md_data_t *decoded, const char *encoded, apr_pool_t *pool)
 
const char * md_util_schemify (apr_pool_t *p, const char *s, const char *def_scheme)
 
apr_status_t md_util_abs_uri_check (apr_pool_t *p, const char *s, const char **perr)
 
apr_status_t md_util_abs_http_uri_check (apr_pool_t *p, const char *uri, const char **perr)
 
const char * md_link_find_relation (const struct apr_table_t *headers, apr_pool_t *pool, const char *relation)
 
apr_status_t md_util_try (md_util_try_fn *fn, void *baton, int ignore_errs, apr_interval_time_t timeout, apr_interval_time_t start_delay, apr_interval_time_t max_delay, int backoff)
 

Macro Definition Documentation

#define MD_DATA_CWRAP (   d,
  buffer 
)    md_data_t d = { buffer, sizeof(buffer) }

Typedef Documentation

typedef struct md_data_t md_data_t
typedef apr_status_t md_util_action(void *baton, apr_pool_t *p, apr_pool_t *ptemp)
typedef apr_status_t md_util_fdo_cb(void *baton, apr_pool_t *p, apr_pool_t *ptemp, const char *dir, const char *name, apr_filetype_e ftype)
typedef apr_status_t md_util_file_cb(void *baton, struct apr_file_t *f, apr_pool_t *p)
typedef apr_status_t md_util_try_fn(void *baton, int i)
typedef apr_status_t md_util_vaction(void *baton, apr_pool_t *p, apr_pool_t *ptemp, va_list ap)

Function Documentation

int md_array_is_empty ( const struct apr_array_header_t array)

Return != 0 iff array is either NULL or empty

int md_array_remove ( struct apr_array_header_t a,
void elem 
)

In an array of pointers, remove all entries == elem. Returns the number of entries removed.

int md_array_remove_at ( struct apr_array_header_t a,
int  idx 
)
int md_array_str_add_missing ( struct apr_array_header_t dest,
struct apr_array_header_t src,
int  case_sensitive 
)
struct apr_array_header_t* md_array_str_clone ( apr_pool_t p,
struct apr_array_header_t array 
)
struct apr_array_header_t* md_array_str_compact ( apr_pool_t p,
struct apr_array_header_t src,
int  case_sensitive 
)

Create a new array with duplicates removed.

int md_array_str_eq ( const struct apr_array_header_t a1,
const struct apr_array_header_t a2,
int  case_sensitive 
)
int md_array_str_index ( const struct apr_array_header_t array,
const char *  s,
int  start,
int  case_sensitive 
)
struct apr_array_header_t* md_array_str_remove ( apr_pool_t p,
struct apr_array_header_t src,
const char *  exclude,
int  case_sensitive 
)

Create a new array with all occurrences of <exclude> removed.

void md_data_assign_pcopy ( md_data_t dest,
const md_data_t src,
apr_pool_t p 
)
md_data_t* md_data_create ( apr_pool_t p,
const char *  data,
apr_size_t  len 
)
md_data_t* md_data_make ( apr_pool_t p,
apr_size_t  len 
)
apr_status_t md_data_to_hex ( const char **  phex,
char  separator,
apr_pool_t p,
const md_data_t data 
)
int md_dns_domains_match ( const apr_array_header_t domains,
const char *  name 
)

Determine if the given domains cover the name, including wildcard matching.

Returns
!= 0 iff name is matched by list of domains
int md_dns_is_name ( apr_pool_t p,
const char *  domain,
int  need_fqdn 
)

Is a host/domain name using allowed characters. Not a wildcard.

Parameters
domainname to check
need_fqdniff != 0, check that domain contains '.'
Returns
!= 0 iff domain looks like a non-wildcard, legal DNS domain name.
int md_dns_is_wildcard ( apr_pool_t p,
const char *  domain 
)

Check if the given domain is a valid wildcard DNS name, e.g. *.example.org

Parameters
domainname to check
Returns
!= 0 iff domain is a DNS wildcard.
struct apr_array_header_t* md_dns_make_minimal ( apr_pool_t p,
struct apr_array_header_t domains 
)

Create a new array with the minimal set out of the given domain names that match all of them. If none of the domains is a wildcard, only duplicates are removed. If domains contain a wildcard, any name matching the wildcard will be removed.

int md_dns_matches ( const char *  pattern,
const char *  domain 
)

Determine iff pattern matches domain, including case-ignore and wildcard domains. It is assumed that both names follow dns syntax.

Returns
!= 0 iff pattern matches domain
int md_file_exists ( const char *  fname,
apr_pool_t p 
)
const char* md_link_find_relation ( const struct apr_table_t headers,
apr_pool_t pool,
const char *  relation 
)
apr_status_t md_text_fcreatex ( const char *  fpath,
apr_fileperms_t  perms,
apr_pool_t p,
const char *  text 
)
apr_status_t md_text_fread8k ( const char **  ptext,
apr_pool_t p,
const char *  fpath 
)
apr_status_t md_text_freplace ( const char *  fpath,
apr_fileperms_t  perms,
apr_pool_t p,
const char *  text 
)
apr_status_t md_util_abs_http_uri_check ( apr_pool_t p,
const char *  uri,
const char **  perr 
)
apr_status_t md_util_abs_uri_check ( apr_pool_t p,
const char *  s,
const char **  perr 
)
apr_size_t md_util_base64url_decode ( md_data_t decoded,
const char *  encoded,
apr_pool_t pool 
)
const char* md_util_base64url_encode ( const md_data_t data,
apr_pool_t pool 
)
apr_status_t md_util_exec ( apr_pool_t p,
const char *  cmd,
const char *const *  argv,
int exit_code 
)
apr_status_t md_util_fcreatex ( struct apr_file_t **  pf,
const char *  fn,
apr_fileperms_t  perms,
apr_pool_t p 
)
apr_status_t md_util_files_do ( md_util_fdo_cb cb,
void baton,
apr_pool_t p,
const char *  path,
  ... 
)
apr_status_t md_util_fopen ( FILE **  pf,
const char *  fn,
const char *  mode 
)
apr_status_t md_util_freplace ( const char *  fpath,
apr_fileperms_t  perms,
apr_pool_t p,
md_util_file_cb write,
void baton 
)
apr_status_t md_util_ftree_remove ( const char *  path,
apr_pool_t p 
)
apr_status_t md_util_is_dir ( const char *  path,
apr_pool_t pool 
)
apr_status_t md_util_is_file ( const char *  path,
apr_pool_t pool 
)
apr_status_t md_util_path_merge ( const char **  ppath,
apr_pool_t p,
  ... 
)
apr_status_t md_util_pool_do ( md_util_action cb,
void baton,
apr_pool_t p 
)
apr_status_t md_util_pool_vdo ( md_util_vaction cb,
void baton,
apr_pool_t p,
  ... 
)
apr_status_t md_util_rm_recursive ( const char *  fpath,
apr_pool_t p,
int  max_level 
)

Remove a file/directory and all files/directories contain up to max_level. If max_level == 0, only an empty directory or a file can be removed.

const char* md_util_schemify ( apr_pool_t p,
const char *  s,
const char *  def_scheme 
)
char* md_util_str_tolower ( char *  s)
apr_status_t md_util_tree_do ( md_util_fdo_cb cb,
void baton,
apr_pool_t p,
const char *  path,
int  follow_links 
)

Depth first traversal of directory tree starting at path.

apr_status_t md_util_try ( md_util_try_fn fn,
void baton,
int  ignore_errs,
apr_interval_time_t  timeout,
apr_interval_time_t  start_delay,
apr_interval_time_t  max_delay,
int  backoff 
)