Qsmtp  0.30dev
Functions | Variables
conn.h File Reference

headers of Qremote functions for connection establishing More...

#include <qdns.h>
#include <netinet/in.h>

Go to the source code of this file.

Functions

int tryconn (struct ips *mx, const struct in6_addr *outip4, const struct in6_addr *outip6)
 
int connect_mx (struct ips *mx, const struct in6_addr *outip4, const struct in6_addr *outip6)
 establish a connection to a MX More...
 
void getmxlist (char *, struct ips **)
 

Variables

unsigned int targetport
 

Detailed Description

headers of Qremote functions for connection establishing

Function Documentation

int connect_mx ( struct ips mx,
const struct in6_addr *  outip4,
const struct in6_addr *  outip6 
)

establish a connection to a MX

Parameters
mxlist of MX ips
outip4address to use when making outgoing IPv4 connections
outip6address to use when making outgoing IPv6 connections
Returns
if the connection was established
Return values
0a connection has been set up
-ENOENTno IPs were left to try

This will return once a connection to a remote host has been successfully established and the greeting of the remote server has been parsed. If no connection can be made this function return -ENOENT.

void getmxlist ( char *  remhost,
struct ips **  mx 
)

get all IPs for the MX entries of target address

Parameters
remhosttarget address
mxlist of MX entries will be stored here, memory will be malloced
int tryconn ( struct ips mx,
const struct in6_addr *  outip4,
const struct in6_addr *  outip6 
)

try to estabish an SMTP connection to one of the hosts in the ip list

Parameters
mxlist of IP adresses to try
outip4local IPv4 to bind
outip6local IPv6 to bind
Returns
the socket descriptor of the open connection
Return values
-ENOENTno IP address left to connect to

Every entry where a connection attempt was made is marked with a priority of MX_PRIORITY_USED, the last one tried with MX_PRIORITY_CURRENT.

Variable Documentation

unsigned int targetport

the port on the destination host to connect to