summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpd.h
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2009-11-08 21:40:06 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2009-11-08 21:40:06 +0000
commit0dfe9b155ae3af80cc0cd39fb4c62e8dd6d2db28 (patch)
tree0a1a6b3248ea8a8426e96d81dc154e66ec6f23c3 /usr.sbin/smtpd/smtpd.h
parent2783b9e7a388c4dd94479d27f871f1d3af90d142 (diff)
- make aliases expansion use a rb tree instead of a tail queue, the code
doesn't take advantage of the new structure yet, but this was a needed change for upcoming improvements. - introduce aliasestree_{lookup,insert,remove} to the aliases api - rename queue_generate_id() to generate_uid() and move it to utils.c as it is used all over the place and not only in queue tree idea discussed with jacekm@, if you update rebuild aliases db, make clean and flush queue
Diffstat (limited to 'usr.sbin/smtpd/smtpd.h')
-rw-r--r--usr.sbin/smtpd/smtpd.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 6d6d5080aaf..17028a8783d 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.154 2009/11/08 19:38:26 gilles Exp $ */
+/* $OpenBSD: smtpd.h,v 1.155 2009/11/08 21:40:05 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -374,7 +374,8 @@ enum alias_type {
};
struct alias {
- TAILQ_ENTRY(alias) entry;
+ RB_ENTRY(alias) entry;
+ u_int64_t id;
enum alias_type type;
union alias_data {
char username[MAXLOGNAME];
@@ -383,7 +384,6 @@ struct alias {
struct path path;
} u;
};
-TAILQ_HEAD(aliaseslist, alias);
enum message_type {
T_MDA_MESSAGE = 0x1,
@@ -726,8 +726,10 @@ struct lkasession {
u_int64_t id;
struct path path;
- struct aliaseslist aliaseslist;
struct deliverylist deliverylist;
+
+ RB_HEAD(aliasestree, alias) aliasestree;
+
u_int8_t iterations;
u_int32_t pending;
enum lkasession_flags flags;
@@ -777,11 +779,16 @@ struct mta_session {
/* aliases.c */
int aliases_exist(struct smtpd *, objid_t, char *);
-int aliases_get(struct smtpd *, objid_t, struct aliaseslist *, char *);
+int aliases_get(struct smtpd *, objid_t, struct aliasestree *, char *);
int aliases_vdomain_exists(struct smtpd *, objid_t, char *);
int aliases_virtual_exist(struct smtpd *, objid_t, struct path *);
-int aliases_virtual_get(struct smtpd *, objid_t, struct aliaseslist *, struct path *);
+int aliases_virtual_get(struct smtpd *, objid_t, struct aliasestree *, struct path *);
int alias_parse(struct alias *, char *);
+int alias_cmp(struct alias *, struct alias *);
+void aliasestree_insert(struct aliasestree *, struct alias *);
+void aliasestree_remove(struct aliasestree *, struct alias *);
+struct alias *aliasestree_lookup(struct aliasestree *, struct alias *);
+RB_PROTOTYPE(aliasestree, alias, entry, alias_cmp);
/* authenticate.c */
int authenticate_user(char *, char *);
@@ -816,7 +823,7 @@ void dns_async(struct smtpd *, struct imsgev *, int,
/* forward.c */
-int forwards_get(int, struct aliaseslist *);
+int forwards_get(int, struct aliasestree *);
/* smtpd.c */
int child_cmp(struct child *, struct child *);
@@ -836,7 +843,6 @@ int msg_cmp(struct message *, struct message *);
/* queue.c */
pid_t queue(struct smtpd *);
-u_int64_t queue_generate_id(void);
int queue_load_envelope(struct message *, char *);
int queue_update_envelope(struct message *);
int queue_remove_envelope(struct message *);
@@ -984,3 +990,4 @@ void message_set_errormsg(struct message *, char *, ...);
char *message_get_errormsg(struct message *);
void sa_set_port(struct sockaddr *, int);
struct path *path_dup(struct path *);
+u_int64_t generate_uid(void);