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

Go to the source code of this file.

Data Structures

struct  srs_ctx
 

Macros

#define SRSDEL   '='
 
#define SRSSEP   "="
 
#define SRS0TAG   "SRS0"
 
#define SRS1TAG   "SRS1"
 
#define SRS_HASHLEN   3
 
#define SRS_ERRTYPE_MASK   0xf000
 
#define SRS_ERRTYPE_NONE   0x0000
 
#define SRS_ERRTYPE_CONFIG   0x1000
 
#define SRS_ERRTYPE_OPER   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_ENOSENDERATSIGN   (3)
 
#define SRS_ENOSECRETS   (SRS_ERRTYPE_CONFIG | 1)
 
#define SRS_ESEPARATORINVALID   (SRS_ERRTYPE_CONFIG | 2)
 
#define SRS_EOUTOFMEMORY   (SRS_ERRTYPE_OPER | 1)
 
#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 X(e, s)   if (code == e) return s;
 

Functions

int srs_init (srs_ctx *)
 
int srs_forward (srs_ctx *, stralloc *, const char *, const char *)
 
int srs_reverse (srs_ctx *, stralloc *, char *)
 
const char * srs_errorstr (int)
 
int srs_create_timestamp (char *, time_t)
 
int srs_check_timestamp (srs_ctx *, char *)
 

Macro Definition Documentation

◆ SRS0TAG

#define SRS0TAG   "SRS0"

Definition at line 15 of file srsq.h.

◆ SRS1TAG

#define SRS1TAG   "SRS1"

Definition at line 16 of file srsq.h.

◆ SRS_EBADTIMESTAMPCHAR

#define SRS_EBADTIMESTAMPCHAR   (SRS_ERRTYPE_SYNTAX | 8)

Definition at line 45 of file srsq.h.

◆ SRS_EHASHINVALID

#define SRS_EHASHINVALID   (SRS_ERRTYPE_SRS | 2)

Definition at line 49 of file srsq.h.

◆ SRS_EHASHTOOSHORT

#define SRS_EHASHTOOSHORT   (SRS_ERRTYPE_SYNTAX | 9)

Definition at line 46 of file srsq.h.

◆ SRS_ENOSECRETS

#define SRS_ENOSECRETS   (SRS_ERRTYPE_CONFIG | 1)

Definition at line 33 of file srsq.h.

◆ SRS_ENOSENDERATSIGN

#define SRS_ENOSENDERATSIGN   (3)

Definition at line 31 of file srsq.h.

◆ SRS_ENOSRS0HASH

#define SRS_ENOSRS0HASH   (SRS_ERRTYPE_SYNTAX | 3)

Definition at line 40 of file srsq.h.

◆ SRS_ENOSRS0HOST

#define SRS_ENOSRS0HOST   (SRS_ERRTYPE_SYNTAX | 1)

Definition at line 38 of file srsq.h.

◆ SRS_ENOSRS0STAMP

#define SRS_ENOSRS0STAMP   (SRS_ERRTYPE_SYNTAX | 4)

Definition at line 41 of file srsq.h.

◆ SRS_ENOSRS0USER

#define SRS_ENOSRS0USER   (SRS_ERRTYPE_SYNTAX | 2)

Definition at line 39 of file srsq.h.

◆ SRS_ENOSRS1HASH

#define SRS_ENOSRS1HASH   (SRS_ERRTYPE_SYNTAX | 7)

Definition at line 44 of file srsq.h.

◆ SRS_ENOSRS1HOST

#define SRS_ENOSRS1HOST   (SRS_ERRTYPE_SYNTAX | 5)

Definition at line 42 of file srsq.h.

◆ SRS_ENOSRS1USER

#define SRS_ENOSRS1USER   (SRS_ERRTYPE_SYNTAX | 6)

Definition at line 43 of file srsq.h.

◆ SRS_ENOTREWRITTEN

#define SRS_ENOTREWRITTEN   (2)

Definition at line 30 of file srsq.h.

◆ SRS_ENOTSRSADDRESS

#define SRS_ENOTSRSADDRESS   (1)

Definition at line 29 of file srsq.h.

◆ SRS_EOUTOFMEMORY

#define SRS_EOUTOFMEMORY   (SRS_ERRTYPE_OPER | 1)

Definition at line 36 of file srsq.h.

◆ SRS_ERROR_TYPE

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

Definition at line 51 of file srsq.h.

◆ SRS_ERRTYPE_CONFIG

#define SRS_ERRTYPE_CONFIG   0x1000

Definition at line 23 of file srsq.h.

◆ SRS_ERRTYPE_MASK

#define SRS_ERRTYPE_MASK   0xf000

Definition at line 21 of file srsq.h.

◆ SRS_ERRTYPE_NONE

#define SRS_ERRTYPE_NONE   0x0000

Definition at line 22 of file srsq.h.

◆ SRS_ERRTYPE_OPER

#define SRS_ERRTYPE_OPER   0x2000

Definition at line 24 of file srsq.h.

◆ SRS_ERRTYPE_SRS

#define SRS_ERRTYPE_SRS   0x8000

Definition at line 26 of file srsq.h.

◆ SRS_ERRTYPE_SYNTAX

#define SRS_ERRTYPE_SYNTAX   0x4000

Definition at line 25 of file srsq.h.

◆ SRS_ESEPARATORINVALID

#define SRS_ESEPARATORINVALID   (SRS_ERRTYPE_CONFIG | 2)

Definition at line 34 of file srsq.h.

◆ SRS_ETIMESTAMPOUTOFDATE

#define SRS_ETIMESTAMPOUTOFDATE   (SRS_ERRTYPE_SRS | 1)

Definition at line 48 of file srsq.h.

◆ SRS_HASHLEN

#define SRS_HASHLEN   3

Definition at line 17 of file srsq.h.

◆ SRS_IS_SRS_ADDRESS

#define SRS_IS_SRS_ADDRESS (   x)
Value:
( \
(case_diffb((x),3,"SRS") == 0) && \
(str_chr("01", (x)[3]) != 2) && \
(str_chr("-+=", (x)[4]) != 4) \
)

Definition at line 55 of file srsq.h.

◆ SRS_SUCCESS

#define SRS_SUCCESS   (0)

Definition at line 28 of file srsq.h.

◆ SRSDEL

#define SRSDEL   '='

Definition at line 13 of file srsq.h.

◆ SRSSEP

#define SRSSEP   "="

Definition at line 14 of file srsq.h.

◆ X

#define X (   e,
 
)    if (code == e) return s;

Definition at line 61 of file srsq.h.

Function Documentation

◆ srs_check_timestamp()

int srs_check_timestamp ( srs_ctx srs,
char *  stamp 
)

Definition at line 101 of file srsq.c.

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

◆ srs_create_timestamp()

int srs_create_timestamp ( char *  buf,
time_t  now 
)

Definition at line 89 of file srsq.c.

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

◆ srs_errorstr()

const char * srs_errorstr ( int  code)

Definition at line 29 of file srsq.c.

Here is the caller graph for this function:

◆ srs_forward()

int srs_forward ( srs_ctx srs,
stralloc *  srsaddr,
const char *  sender,
const char *  alias 
)

Definition at line 360 of file srsq.c.

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

◆ srs_init()

int srs_init ( srs_ctx srs)

Definition at line 62 of file srsq.c.

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

◆ srs_reverse()

int srs_reverse ( srs_ctx srs,
stralloc *  srsaddr,
char *  inaddr 
)

Definition at line 324 of file srsq.c.

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