s/qmail 4.3.20
Next generation secure email transport
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
srs2.h File Reference
#include <stdint.h>
#include <time.h>
Include dependency graph for srs2.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _srs_t
 

Macros

#define TRUE   1
 
#define FALSE   0
 
#define SRSSEP   '='
 
#define SRS0TAG   "SRS0"
 
#define SRS1TAG   "SRS1"
 
#define SRS_ERRTYPE_MASK   0xf000
 
#define SRS_ERRTYPE_NONE   0x0000
 
#define SRS_ERRTYPE_CONFIG   0x1000
 
#define SRS_ERRTYPE_INPUT   0x2000
 
#define SRS_ERRTYPE_SYNTAX   0x4000
 
#define SRS_ERRTYPE_SRS   0x8000
 
#define SRS_SUCCESS   (0)
 
#define SRS_ENOTSRSADDRESS   (1)
 
#define SRS_ENOTREWRITTEN   (2)
 
#define SRS_ENOSECRETS   (SRS_ERRTYPE_CONFIG | 1)
 
#define SRS_ESEPARATORINVALID   (SRS_ERRTYPE_CONFIG | 2)
 
#define SRS_ENOSENDERATSIGN   (SRS_ERRTYPE_INPUT | 1)
 
#define SRS_EBUFTOOSMALL   (SRS_ERRTYPE_INPUT | 2)
 
#define SRS_ENOSRS0HOST   (SRS_ERRTYPE_SYNTAX | 1)
 
#define SRS_ENOSRS0USER   (SRS_ERRTYPE_SYNTAX | 2)
 
#define SRS_ENOSRS0HASH   (SRS_ERRTYPE_SYNTAX | 3)
 
#define SRS_ENOSRS0STAMP   (SRS_ERRTYPE_SYNTAX | 4)
 
#define SRS_ENOSRS1HOST   (SRS_ERRTYPE_SYNTAX | 5)
 
#define SRS_ENOSRS1USER   (SRS_ERRTYPE_SYNTAX | 6)
 
#define SRS_ENOSRS1HASH   (SRS_ERRTYPE_SYNTAX | 7)
 
#define SRS_EBADTIMESTAMPCHAR   (SRS_ERRTYPE_SYNTAX | 8)
 
#define SRS_EHASHTOOSHORT   (SRS_ERRTYPE_SYNTAX | 9)
 
#define SRS_ETIMESTAMPOUTOFDATE   (SRS_ERRTYPE_SRS | 1)
 
#define SRS_EHASHINVALID   (SRS_ERRTYPE_SRS | 2)
 
#define SRS_ERROR_TYPE(x)   ((x) & SRS_ERRTYPE_MASK)
 
#define SRS_IS_SRS_ADDRESS(x)
 
#define SRS_PARAM_DECLARE(n, t)
 

Typedefs

typedef void *(* srs_malloc_t) (size_t)
 
typedef void *(* srs_realloc_t) (void *, size_t)
 
typedef void(* srs_free_t) (void *)
 
typedef int srs_bool
 
typedef struct _srs_t srs_t
 

Functions

int srs_set_malloc (srs_malloc_t m, srs_realloc_t r, srs_free_t f)
 
srs_tsrs_new ()
 
void srs_init (srs_t *)
 
void srs_free (srs_t *)
 
int srs_forward (srs_t *, char *, int, const char *, const char *)
 
int srs_forward_alloc (srs_t *, char **, const char *, const char *)
 
int srs_reverse (srs_t *, char *, int, const char *)
 
int srs_reverse_alloc (srs_t *, char **, const char *)
 
const char * srs_strerror (int)
 
int srs_add_secret (srs_t *, const char *)
 
const char * srs_get_secret (srs_t *, int)
 
int srs_timestamp_create (srs_t *, char *, time_t)
 
int srs_timestamp_check (srs_t *, const char *)
 

Macro Definition Documentation

◆ FALSE

#define FALSE   0

Definition at line 25 of file srs2.h.

◆ SRS0TAG

#define SRS0TAG   "SRS0"

Definition at line 28 of file srs2.h.

◆ SRS1TAG

#define SRS1TAG   "SRS1"

Definition at line 29 of file srs2.h.

◆ SRS_EBADTIMESTAMPCHAR

#define SRS_EBADTIMESTAMPCHAR   (SRS_ERRTYPE_SYNTAX | 8)

Definition at line 57 of file srs2.h.

◆ SRS_EBUFTOOSMALL

#define SRS_EBUFTOOSMALL   (SRS_ERRTYPE_INPUT | 2)

Definition at line 48 of file srs2.h.

◆ SRS_EHASHINVALID

#define SRS_EHASHINVALID   (SRS_ERRTYPE_SRS | 2)

Definition at line 61 of file srs2.h.

◆ SRS_EHASHTOOSHORT

#define SRS_EHASHTOOSHORT   (SRS_ERRTYPE_SYNTAX | 9)

Definition at line 58 of file srs2.h.

◆ SRS_ENOSECRETS

#define SRS_ENOSECRETS   (SRS_ERRTYPE_CONFIG | 1)

Definition at line 44 of file srs2.h.

◆ SRS_ENOSENDERATSIGN

#define SRS_ENOSENDERATSIGN   (SRS_ERRTYPE_INPUT | 1)

Definition at line 47 of file srs2.h.

◆ SRS_ENOSRS0HASH

#define SRS_ENOSRS0HASH   (SRS_ERRTYPE_SYNTAX | 3)

Definition at line 52 of file srs2.h.

◆ SRS_ENOSRS0HOST

#define SRS_ENOSRS0HOST   (SRS_ERRTYPE_SYNTAX | 1)

Definition at line 50 of file srs2.h.

◆ SRS_ENOSRS0STAMP

#define SRS_ENOSRS0STAMP   (SRS_ERRTYPE_SYNTAX | 4)

Definition at line 53 of file srs2.h.

◆ SRS_ENOSRS0USER

#define SRS_ENOSRS0USER   (SRS_ERRTYPE_SYNTAX | 2)

Definition at line 51 of file srs2.h.

◆ SRS_ENOSRS1HASH

#define SRS_ENOSRS1HASH   (SRS_ERRTYPE_SYNTAX | 7)

Definition at line 56 of file srs2.h.

◆ SRS_ENOSRS1HOST

#define SRS_ENOSRS1HOST   (SRS_ERRTYPE_SYNTAX | 5)

Definition at line 54 of file srs2.h.

◆ SRS_ENOSRS1USER

#define SRS_ENOSRS1USER   (SRS_ERRTYPE_SYNTAX | 6)

Definition at line 55 of file srs2.h.

◆ SRS_ENOTREWRITTEN

#define SRS_ENOTREWRITTEN   (2)

Definition at line 42 of file srs2.h.

◆ SRS_ENOTSRSADDRESS

#define SRS_ENOTSRSADDRESS   (1)

Definition at line 41 of file srs2.h.

◆ SRS_ERROR_TYPE

#define SRS_ERROR_TYPE (   x)    ((x) & SRS_ERRTYPE_MASK)

Definition at line 63 of file srs2.h.

◆ SRS_ERRTYPE_CONFIG

#define SRS_ERRTYPE_CONFIG   0x1000

Definition at line 35 of file srs2.h.

◆ SRS_ERRTYPE_INPUT

#define SRS_ERRTYPE_INPUT   0x2000

Definition at line 36 of file srs2.h.

◆ SRS_ERRTYPE_MASK

#define SRS_ERRTYPE_MASK   0xf000

Definition at line 33 of file srs2.h.

◆ SRS_ERRTYPE_NONE

#define SRS_ERRTYPE_NONE   0x0000

Definition at line 34 of file srs2.h.

◆ SRS_ERRTYPE_SRS

#define SRS_ERRTYPE_SRS   0x8000

Definition at line 38 of file srs2.h.

◆ SRS_ERRTYPE_SYNTAX

#define SRS_ERRTYPE_SYNTAX   0x4000

Definition at line 37 of file srs2.h.

◆ SRS_ESEPARATORINVALID

#define SRS_ESEPARATORINVALID   (SRS_ERRTYPE_CONFIG | 2)

Definition at line 45 of file srs2.h.

◆ SRS_ETIMESTAMPOUTOFDATE

#define SRS_ETIMESTAMPOUTOFDATE   (SRS_ERRTYPE_SRS | 1)

Definition at line 60 of file srs2.h.

◆ SRS_IS_SRS_ADDRESS

#define SRS_IS_SRS_ADDRESS (   x)
Value:
( \
(strncasecmp((x),"SRS",3) == 0) && \
(strchr("01", (x)[3]) != NULL) && \
(strchr("-+=", (x)[4]) != NULL) \
)

Definition at line 67 of file srs2.h.

◆ SRS_PARAM_DECLARE

#define SRS_PARAM_DECLARE (   n,
 
)
Value:
int srs_set_ ## n (srs_t *srs, t value); \
t srs_get_ ## n (srs_t *srs);
Definition: srs2.h:79

Definition at line 114 of file srs2.h.

◆ SRS_SUCCESS

#define SRS_SUCCESS   (0)

Definition at line 40 of file srs2.h.

◆ SRSSEP

#define SRSSEP   '='

Definition at line 27 of file srs2.h.

◆ TRUE

#define TRUE   1

Definition at line 23 of file srs2.h.

Typedef Documentation

◆ srs_bool

typedef int srs_bool

Definition at line 77 of file srs2.h.

◆ srs_free_t

typedef void(* srs_free_t) (void *)

Definition at line 75 of file srs2.h.

◆ srs_malloc_t

typedef void *(* srs_malloc_t) (size_t)

Definition at line 73 of file srs2.h.

◆ srs_realloc_t

typedef void *(* srs_realloc_t) (void *, size_t)

Definition at line 74 of file srs2.h.

◆ srs_t

typedef struct _srs_t srs_t

Function Documentation

◆ srs_add_secret()

int srs_add_secret ( srs_t srs,
const char *  secret 
)

Definition at line 137 of file srs2.c.

Here is the caller graph for this function:

◆ srs_forward()

int srs_forward ( srs_t srs,
char *  buf,
int  buflen,
const char *  sender,
const char *  alias 
)

Definition at line 528 of file srs2.c.

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

◆ srs_forward_alloc()

int srs_forward_alloc ( srs_t srs,
char **  sptr,
const char *  sender,
const char *  alias 
)

Definition at line 570 of file srs2.c.

Here is the call graph for this function:

◆ srs_free()

void srs_free ( srs_t srs)

Definition at line 126 of file srs2.c.

◆ srs_get_secret()

const char * srs_get_secret ( srs_t srs,
int  idx 
)

Definition at line 145 of file srs2.c.

◆ srs_init()

void srs_init ( srs_t srs)

Definition at line 114 of file srs2.c.

Here is the caller graph for this function:

◆ srs_new()

srs_t * srs_new ( )

Definition at line 107 of file srs2.c.

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

◆ srs_reverse()

int srs_reverse ( srs_t srs,
char *  buf,
int  buflen,
const char *  sender 
)

Definition at line 599 of file srs2.c.

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

◆ srs_reverse_alloc()

int srs_reverse_alloc ( srs_t srs,
char **  sptr,
const char *  sender 
)

Definition at line 624 of file srs2.c.

Here is the call graph for this function:

◆ srs_set_malloc()

int srs_set_malloc ( srs_malloc_t  m,
srs_realloc_t  r,
srs_free_t  f 
)

Definition at line 64 of file srs2.c.

◆ srs_strerror()

const char * srs_strerror ( int  code)

Definition at line 74 of file srs2.c.

Here is the caller graph for this function:

◆ srs_timestamp_check()

int srs_timestamp_check ( srs_t srs,
const char *  stamp 
)

Definition at line 204 of file srs2.c.

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

◆ srs_timestamp_create()

int srs_timestamp_create ( srs_t srs,
char *  buf,
time_t  now 
)

Definition at line 194 of file srs2.c.

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