view src/dccifd.h @ 202:ae0585d64dd2

Added tag stable-6-0-16 for changeset 752d4315675c
author Carl Byington <carl@five-ten-sg.com>
date Sat, 02 Feb 2008 12:32:59 -0800
parents ff6d14d75b1e
children 82886d4dd71f
line wrap: on
line source

/*

Copyright (c) 2007 Carl Byington - 510 Software Group, released under
the GPL version 3 or any later version at your choice available at
http://www.gnu.org/licenses/gpl-3.0.txt

*/

#ifndef _DCCIFD_H
#define _DCCIFD_H

extern "C" {
	#include <libmilter/mfapi.h>
}

#ifdef HAVE_CDEFS_H
#include <sys/cdefs.h>
#endif

#include <list>

using namespace std;

class mlfiPriv;

class DccInterface {
public:
	DccInterface(char *port_, mlfiPriv *priv_, int ip, char *helo_, char *from);
	~DccInterface();

	void mlfi_envrcpt(SMFICTX *ctx, char *envrcpt, bool grey);
	void mlfi_header(SMFICTX *ctx, char* headerf, char* headerv);
	void mlfi_eoh();
	void mlfi_body(u_char *bodyp, size_t bodylen);
	void mlfi_eom(bool &grey, int &bulk);

private:
	void my_disconnect();
	void Connect();
	size_t my_write(const char *buf, size_t len);
	size_t my_read(char *buf, size_t len);
	void output(const char*buffer, size_t size);
	void output(const char*buffer);
	void output(string buffer);
	void close_output();
	void input();
	char *getmacro(SMFICTX *ctx, char *macro, char *def);

public:
	bool err;				// socket write error
	bool first_recipient;	// have we not seen any recipients?
	bool first_header;		// have we not seen any headers?

	// connection back to main dnsbl priv structure for logging
	mlfiPriv *priv;
	int 	 ip4;		// ip4 address of smtp client

	// strings owned by main dnsbl
	char *helo; 		// client helo value
	char *envfrom;		// envelope from value for this message

	// Process handling variables
	int    dccifd_socket;
	char  *dccifd_port;
	string dccifd_output;	// to dccifd socket
	string dccifd_input;	// from dccifd socket
};

#endif