Qsmtp  0.30dev
Data Structures | Macros | Functions | Variables
qsmtpd.h File Reference

definitions for common parts from Qsmtpd exported from qsmtpd.c More...

#include <qdns.h>
#include <sstring.h>
#include <netinet/in.h>
#include <sys/queue.h>
#include <sys/types.h>

Go to the source code of this file.

Data Structures

struct  smtpcomm
 
struct  xmitstat
 
struct  recip
 list of recipients given for this transaction More...
 

Macros

#define EBOGUS   1002
 
#define EDONE   1003
 
#define HELOSTR   (xmitstat.helostr.len ? xmitstat.helostr.s : xmitstat.remotehost.s)
 
#define HELOLEN   (xmitstat.helostr.len ? xmitstat.helostr.len : xmitstat.remotehost.len)
 
#define MAILFROM   (xmitstat.mailfrom.len ? xmitstat.mailfrom.s : "")
 

Functions

int err_control (const char *)
 write and log error message if opening config file leads to an error More...
 
int err_control2 (const char *, const char *)
 write and log error message if opening config file leads to an error More...
 
void freedata (void)
 free all ressources allocated for mail transaction
 
pid_t fork_clean ()
 fork() but clean up internal structures More...
 
int pipe_move (int p[2], int target)
 move the read end of the pipe to the target descriptor More...
 
void conn_cleanup (const int rc)
 clean up the allocated data and exit the process More...
 
 TAILQ_HEAD (, recip) head
 
static int connection_is_ipv4 (void)
 
static int is_authenticated_client (void)
 

Variables

struct smtpcommcurrent_command
 
struct xmitstat xmitstat
 
string heloname
 
string msgidhost
 
string liphost
 
unsigned int goodrcpt
 
int badbounce
 
unsigned long sslauth
 
unsigned long databytes
 
int relayclient
 
unsigned long comstate
 
int authhide
 
int submission_mode
 
struct recipthisrecip
 

Detailed Description

definitions for common parts from Qsmtpd exported from qsmtpd.c

Function Documentation

void conn_cleanup ( const int  rc)

clean up the allocated data and exit the process

Parameters
rcdesired return code of the process
int err_control ( const char *  fn)

write and log error message if opening config file leads to an error

Parameters
fnname of the file that caused the error
See also
err_control2
int err_control2 ( const char *  msg,
const char *  fn 
)

write and log error message if opening config file leads to an error

Parameters
msgadditional message to log
fnname of the file that caused the error
See also
err_control
pid_t fork_clean ( )

fork() but clean up internal structures

This will work exactly like fork(). If it returns 0 (i.e. you are the child) it will also clean the memory mappings etc. of the Qsmtpd process that the child doesn't need.

int pipe_move ( int  p[2],
int  target 
)

move the read end of the pipe to the target descriptor

Parameters
pboth ends of the pipe
targetthe target descriptor of the read end
Returns
if everything went smooth
Return values
0everything is fine

This will move the read end of the pipe to target, closing both the write end of the pipe and the old read end of the pipe. This is intended to be called in the child process directly after forking, but before execve().

Variable Documentation

int authhide

hide source of authenticated mail

int badbounce

bounce message with more than one recipient

unsigned long comstate

status of the command state machine

status of the command state machine, initialized to noop

struct smtpcomm* current_command

the SMTP command currently processed

unsigned long databytes

maximum message size

unsigned int goodrcpt

number of valid recipients

string heloname

the fqdn to show in helo

string liphost

replacement domain if to address is <foo@[ip]>

replacement domain if TO address is <foo@[ip]>

string msgidhost

the fqdn to use if a message-id is added

int relayclient

flag if this client is allowed to relay by IP: 0 unchecked, 1 allowed, 2 denied

unsigned long sslauth

if SMTP AUTH is only allowed after STARTTLS

int submission_mode

if we should act as message submission agent

This contains some flags describing the transmission and it's status.