diff src/context.h @ 136:f4746d8a12a3

add smtp auth rate limits
author carl
date Tue, 26 Sep 2006 13:59:14 -0700
parents d9d2f8699621
children 4028de9b46dd
line wrap: on
line diff
--- a/src/context.h	Wed Aug 02 21:33:34 2006 -0700
+++ b/src/context.h	Tue Sep 26 13:59:14 2006 -0700
@@ -28,6 +28,7 @@
 typedef list<CONTEXTP>					  context_list;
 typedef map<char *, CONTEXTP, ltstr>	  context_map;
 typedef map<char *, int, ltstr> 		  ns_mapper;
+typedef map<char *, int, ltstr> 		  rcpt_rates;
 typedef map<char *, VERIFYP, ltstr> 	  verify_map;
 
 class SMTP {
@@ -111,6 +112,8 @@
 	char *			tag_limit_message;	// error message for excessive bad html tags
 	dnsblp_map		dnsbl_names;		// name to dnsbl mapping for lists that are available in this context and children
 	dnsblp_list 	dnsbl_list; 		// list of dnsbls to be used in this context
+	rcpt_rates		rcpt_per_hour;		// per user limits on number of recipients per hour
+
 
 public:
 	CONTEXT(CONTEXTP parent_, char *name_);
@@ -126,6 +129,9 @@
 	char*		get_verify()								{return verify_host;};
 	VERIFYP 	find_verify(char *to);
 
+	void		add_rate(char *user, int limit) 			{rcpt_per_hour[user] = limit;};
+	int 		find_rate(char *user);
+
 	void		add_to(char *to)							{env_to.insert(to);};
 	void		add_from(char *from, char *status)			{env_from[from] = status;};
 	void		add_from_context(char *from, CONTEXTP con)	{env_from_context[from] = con;};
@@ -194,6 +200,10 @@
 	void		dump();
 };
 
+struct RATELIMIT {
+
+};
+
 extern char *token_black;
 extern char *token_cctld;
 extern char *token_content;
@@ -219,6 +229,7 @@
 extern char *token_ok2;
 extern char *token_ok;
 extern char *token_on;
+extern char *token_rate;
 extern char *token_rbrace;
 extern char *token_semi;
 extern char *token_soft;