Qsmtp  0.30dev
Macros | Functions | Variables
qremote.h File Reference

definitions for common parts from Qremote exported from qremote.c More...

#include "sstring.h"
#include <netinet/in.h>

Go to the source code of this file.

Macros

#define EDONE   1003
 

Functions

void err_mem (const int)
 
void err_conf (const char *)
 
void err_confn (const char **, void *)
 log a configuration error and exit More...
 
void remote_common_setup (void)
 
int netget (const unsigned int terminate)
 get one line from the network More...
 
void write_status_raw (const char *str, const size_t len)
 write raw status message to qmail-rspawn More...
 
void write_status (const char *str)
 write status message to qmail-rspawn More...
 
void write_status_m (const char **strs, const unsigned int count)
 write status messages to qmail-rspawn More...
 
struct ipssmtproute (const char *, const size_t, unsigned int *)
 get static route for domain More...
 
void quitmsg (void)
 send QUIT to the remote server and close the connection More...
 

Variables

char * rhost
 
size_t rhostlen
 
char * partner_fqdn
 
unsigned int smtpext
 
string heloname
 
char * clientcertbuf
 
struct in6_addr outgoingip
 
struct in6_addr outgoingip6
 

Detailed Description

definitions for common parts from Qremote exported from qremote.c

Function Documentation

void err_confn ( const char **  errmsg,
void *  freebuf 
)

log a configuration error and exit

Parameters
errmsgarray of strings to combine to the message to log
freebufa pointer to a buffer passed to free() after logging

Use freebuf if the contents of this buffer need to be part of errmsg. If you do not have anything to free just pass NULL.

int netget ( const unsigned int  terminate)

get one line from the network

Parameters
terminateif the program should be terminated on errors
Returns
SMTP return code of the message or negative error code
Return values
-EINVALthe server send a reply that was syntactically invalid

If an out of memory condition occurs the program will be terminated regardless of the terminate parameter.

If an error occurs and terminate is not set the connection will be shut down before the function returns unless the return code is -EINVAL.

void quitmsg ( void  )

send QUIT to the remote server and close the connection

This will properly shut down the connection to the remote server but will not terminate the program.

struct ips* smtproute ( const char *  remhost,
const size_t  reml,
unsigned int *  targetport 
)

get static route for domain

Parameters
remhosttarget to look up
remlstrlen(remhost)
targetportport on the remote host to connect to
Returns
MX list if route present
Return values
NULLa runtime error occurred while reading the control file, errno is set

If control/smtproutes contains a syntax error the program is terminated. On runtime error (out of memory) NULL is returned and errno is set.

void write_status ( const char *  str)

write status message to qmail-rspawn

Parameters
strthe string to write

This will include the trailing 0-byte in the output as qmail-rspawn awaits that as separator between the output fields.

void write_status_m ( const char **  strs,
const unsigned int  count 
)

write status messages to qmail-rspawn

Parameters
strsthe strings to write
counthow many strings to write

This will include the trailing 0-byte after the last entry in the output as qmail-rspawn awaits that as separator between the output fields.

void write_status_raw ( const char *  str,
const size_t  len 
)

write raw status message to qmail-rspawn

Parameters
strthe data to write
lenlength of the data to write

Variable Documentation

string heloname

the fqdn to show in helo

char* partner_fqdn

the DNS name of the remote server (forward-lookup), or NULL if the connection was done by IP

char* rhost

the DNS name (if present) and IP address of the remote server to be used in log messages

size_t rhostlen

valid length of rhost

unsigned int smtpext

the SMTP extensions supported by the remote server