Commit 808ca0c2 808ca0c2fc93de54dab7465ec5a11b73d60ce385 by Alain Magloire

implementing sendmail.

1 parent 0d65dd09
......@@ -15,8 +15,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _ATTRIBUTE_H
#define _ATTRIBUTE_H
#ifndef _MAILUTILS_ATTRIBUTE_H
#define _MAILUTILS_ATTRIBUTE_H
#include <sys/types.h>
......@@ -45,7 +45,9 @@ typedef struct _attribute * attribute_t;
extern int attribute_create __P ((attribute_t *, void *));
extern void attribute_destroy __P ((attribute_t *, void *));
extern void * attribute_get_owner __P ((attribute_t));
extern int attribute_is_userflag __P ((attribute_t, int));
extern int attribute_is_seen __P ((attribute_t));
extern int attribute_is_answered __P ((attribute_t));
extern int attribute_is_flagged __P ((attribute_t));
......@@ -54,6 +56,7 @@ extern int attribute_is_draft __P ((attribute_t));
extern int attribute_is_recent __P ((attribute_t));
extern int attribute_is_read __P ((attribute_t));
extern int attribute_set_userflag __P ((attribute_t, int));
extern int attribute_set_seen __P ((attribute_t));
extern int attribute_set_answered __P ((attribute_t));
extern int attribute_set_flagged __P ((attribute_t));
......@@ -62,6 +65,7 @@ extern int attribute_set_draft __P ((attribute_t));
extern int attribute_set_recent __P ((attribute_t));
extern int attribute_set_read __P ((attribute_t));
extern int attribute_unset_userflag __P ((attribute_t, int));
extern int attribute_unset_seen __P ((attribute_t));
extern int attribute_unset_answered __P ((attribute_t));
extern int attribute_unset_flagged __P ((attribute_t));
......@@ -92,4 +96,4 @@ extern int flags_to_string __P ((int flags, char *buf,
}
#endif
#endif /* _ATTRIBUTE_H */
#endif /* _MAILUTILS_ATTRIBUTE_H */
......
......@@ -15,8 +15,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _AUTH_H
#define _AUTH_H
#ifndef _MAILUTILS_AUTH_H
#define _MAILUTILS_AUTH_H
#include <sys/types.h>
......@@ -33,30 +33,31 @@ extern "C" {
#endif
/* forward declaration */
struct _auth;
typedef struct _auth *auth_t;
struct _ticket;
typedef struct _ticket *ticket_t;
extern int auth_create __P ((auth_t *, void *owner));
extern void auth_destroy __P ((auth_t *, void *owner));
extern int ticket_create __P ((ticket_t *, void *owner));
extern void ticket_destroy __P ((ticket_t *, void *owner));
extern void * ticket_get_owner __P ((ticket_t));
extern int auth_prologue __P ((auth_t));
extern int auth_set_prologue __P ((auth_t auth,
int (*_prologue) __P ((auth_t)),
void *owner));
extern int ticket_pop __P ((ticket_t, const char *, char **));
extern int auth_authenticate __P ((auth_t, char **, char **));
extern int auth_set_authenticate __P ((auth_t auth,
int (*_authenticate)
__P ((auth_t, char **, char **)),
void *owner));
extern int ticket_get_type __P ((ticket_t, char *, size_t, size_t *));
extern int ticket_set_type __P ((ticket_t, char *));
extern int auth_epilogue __P ((auth_t));
extern int auth_set_epilogue __P ((auth_t auth,
int (*_epilogue) __P ((auth_t)),
void *owner));
struct _authority;
typedef struct _authority *authority_t;
extern int authority_create __P ((authority_t *, ticket_t, void *));
extern void authority_destroy __P ((authority_t *, void *));
extern void *authority_get_owner __P ((authority_t));
extern int authority_set_ticket __P ((authority_t, ticket_t));
extern int authority_get_ticket __P ((authority_t, ticket_t *));
extern int authority_authenticate __P ((authority_t));
extern int authority_set_authenticate __P ((authority_t, int (*_authenticate) __P ((authority_t)), void *));
#ifdef _cplusplus
}
#endif
#endif /* _AUTH_H */
#endif /* _MAILUTILS_AUTH_H */
......
......@@ -15,8 +15,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _BODY_H
#define _BODY_H
#ifndef _MAILUTILS_BODY_H
#define _MAILUTILS_BODY_H
#include <sys/types.h>
#include <mailutils/stream.h>
......@@ -39,6 +39,7 @@ typedef struct _body *body_t;
extern int body_create __P ((body_t *, void *owner));
extern void body_destroy __P ((body_t *, void *owner));
extern void * body_get_owner __P ((body_t));
extern int body_get_stream __P ((body_t, stream_t *));
extern int body_set_stream __P ((body_t, stream_t, void *owner));
......@@ -57,4 +58,4 @@ extern int body_set_lines __P ((body_t, int (*_lines)
}
#endif
#endif /* _BODY_H */
#endif /* _MAILUTILS_BODY_H */
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _MAILUTILS_DEBUG_H
#define _MAILUTILS_DEBUG_H
#include <sys/types.h>
#include <stdarg.h>
#ifndef __P
#ifdef __STDC__
#define __P(args) args
#else
#define __P(args) ()
#endif
#endif /*__P */
#ifdef _cplusplus
extern "C" {
#endif
struct _debug;
typedef struct _debug* debug_t;
#define MU_DEBUG_TRACE 1
#define MU_DEBUG_PROT 2
extern int debug_create __P ((debug_t *, void *owner));
extern void debug_destroy __P ((debug_t *, void *owner));
extern void * debug_get_owner __P ((debug_t));
extern int debug_set_level __P ((debug_t, size_t level));
extern int debug_get_level __P ((debug_t, size_t *plevel));
extern int debug_print __P ((debug_t debug, size_t level,
const char *format, ...));
extern int debug_set_print __P ((debug_t, int (*_print) __P ((debug_t, const char *, va_list)), void *owner));
#ifdef _cplusplus
}
#endif
#endif /* _MAILUTILS_DEBUG_H */
......@@ -15,8 +15,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _HEADER_H
#define _HEADER_H
#ifndef _MAILUTILS_HEADER_H
#define _MAILUTILS_HEADER_H
#include <sys/types.h>
#include <mailutils/stream.h>
......@@ -70,6 +70,7 @@ typedef struct _header * header_t;
extern int header_create __P ((header_t *, const char *,
size_t, void *));
extern void header_destroy __P ((header_t *, void *));
extern void * header_get_owner __P ((header_t));
extern int header_set_value __P ((header_t, const char *,
const char *, int));
......@@ -98,4 +99,4 @@ extern int header_set_lines __P ((header_t, int (*_lines)
}
#endif
#endif /* HEADER_H */
#endif /* _MAILUTILS_HEADER_H */
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _MAILUTILS_ITERATOR_H
#define _MAILUTILS_ITERATOR_H
#include <mailutils/list.h>
#include <sys/types.h>
#ifndef __P
#ifdef __STDC__
#define __P(args) args
#else
#define __P(args) ()
#endif
#endif /*__P */
#ifdef _cplusplus
extern "C" {
#endif
struct _iterator;
typedef struct _iterator *iterator_t;
extern int iterator_create __P ((iterator_t *, list_t));
extern void iterator_destroy __P ((iterator_t *));
extern int iterator_first __P ((iterator_t));
extern int iterator_next __P ((iterator_t));
extern int iterator_current __P ((iterator_t, void **pitem));
extern int iterator_is_done __P ((iterator_t));
#ifdef _cplusplus
}
#endif
#endif /* _MAILUTILS_ITERATOR_H */
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _MAILUTILS_LIST_H
#define _MAILUTILS_LIST_H
#include <sys/types.h>
#ifndef __P
# ifdef __STDC__
# define __P(args) args
# else
# define __P(args) ()
# endif
#endif /*__P */
#ifdef _cplusplus
extern "C" {
#endif
struct _list;
typedef struct _list *list_t;
extern int list_create __P ((list_t *));
extern void list_destroy __P ((list_t *));
extern int list_append __P ((list_t, void *item));
extern int list_prepend __P ((list_t, void *item));
extern int list_count __P ((list_t, size_t *pcount));
extern int list_remove __P ((list_t, void *item));
extern int list_get __P ((list_t, size_t _index, void **pitem));
#ifdef _cplusplus
}
#endif
#endif /* _MAILUTILS_LIST_H */
......@@ -15,8 +15,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _LOCKER_H
#define _LOCKER_H
#ifndef _MAILUTILS_LOCKER_H
#define _MAILUTILS_LOCKER_H
#include <sys/types.h>
......@@ -55,4 +55,4 @@ extern int locker_unlock __P ((locker_t));
}
#endif
#endif /* _MAILBOX_H */
#endif /* _MAILUTILS_MAILBOX_H */
......
......@@ -15,14 +15,15 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _MAILBOX_H
# define _MAILBOX_H
#ifndef _MAILUTILS_MAILBOX_H
# define _MAILUTILS_MAILBOX_H
#include <sys/types.h>
#include <mailutils/url.h>
#include <mailutils/observer.h>
#include <mailutils/debug.h>
#include <mailutils/message.h>
#include <mailutils/attribute.h>
#include <mailutils/auth.h>
#include <mailutils/locker.h>
#include <mailutils/stream.h>
......@@ -40,78 +41,54 @@ extern "C" {
# endif
#endif /*__P */
/* forward declaration */
/* Forward declaration. */
struct _mailbox;
typedef struct _mailbox *mailbox_t;
/* constructor/destructor and possible types */
extern int mailbox_create __P ((mailbox_t *, const char *, int id));
/* Constructor/destructor and possible types. */
extern int mailbox_create __P ((mailbox_t *, const char *, int));
extern void mailbox_destroy __P ((mailbox_t *));
extern int mailbox_create_default __P ((mailbox_t *, const char *));
/* flags for mailbox_open () */
#define MU_MAILBOX_RDONLY MU_STREAM_READ
#define MU_MAILBOX_WRONLY MU_STREAM_WRITE
#define MU_MAILBOX_RDWR MU_STREAM_RDWR
#define MU_MAILBOX_APPEND MU_STREAM_APPEND
#define MU_MAILBOX_CREAT MU_STREAM_CREAT
#define MU_MAILBOX_NONBLOCK MU_STREAM_NONBLOCK
extern int mailbox_open __P ((mailbox_t, int flag));
extern int mailbox_close __P ((mailbox_t));
/* messages */
extern int mailbox_get_message __P ((mailbox_t, size_t msgno, message_t *msg));
extern int mailbox_append_message __P ((mailbox_t, message_t msg));
extern int mailbox_messages_count __P ((mailbox_t, size_t *num));
/* Messages. */
extern int mailbox_get_message __P ((mailbox_t, size_t msgno, message_t *));
extern int mailbox_append_message __P ((mailbox_t, message_t));
extern int mailbox_messages_count __P ((mailbox_t, size_t *));
extern int mailbox_expunge __P ((mailbox_t));
/* stream settings */
extern int mailbox_get_stream __P ((mailbox_t, stream_t *pstream));
extern int mailbox_set_stream __P ((mailbox_t, stream_t stream));
/* Lock settings */
extern int mailbox_get_locker __P ((mailbox_t, locker_t *locker));
extern int mailbox_set_locker __P ((mailbox_t, locker_t locker));
/* Authentication */
extern int mailbox_get_auth __P ((mailbox_t, auth_t *auth));
extern int mailbox_set_auth __P ((mailbox_t, auth_t auth));
/* update and scanning*/
/* Update and scanning. */
extern int mailbox_size __P ((mailbox_t, off_t *size));
extern int mailbox_is_updated __P ((mailbox_t));
extern int mailbox_scan __P ((mailbox_t, size_t msgno, size_t *count));
extern int mailbox_scan __P ((mailbox_t, size_t no, size_t *count));
/* mailbox size ? */
extern int mailbox_size __P ((mailbox_t, off_t *size));
/* Stream settings. */
extern int mailbox_get_stream __P ((mailbox_t, stream_t *));
extern int mailbox_set_stream __P ((mailbox_t, stream_t));
extern int mailbox_get_url __P ((mailbox_t, url_t *));
/* Lock settings. */
extern int mailbox_get_locker __P ((mailbox_t, locker_t *));
extern int mailbox_set_locker __P ((mailbox_t, locker_t));
/* events */
#define MU_EVT_MBX_DESTROY 1
#define MU_EVT_MBX_CORRUPTED 2
#define MU_EVT_MBX_MSG_ADD 4
#define MU_EVT_MBX_PROGRESS 8
/* Authentication. */
extern int mailbox_get_ticket __P ((mailbox_t, ticket_t *));
extern int mailbox_set_ticket __P ((mailbox_t, ticket_t));
extern int mailbox_register __P ((mailbox_t mbox, size_t type,
int (*action) (size_t type, void *arg),
void *arg));
extern int mailbox_deregister __P ((mailbox_t mbox, void *action));
/* URL. */
extern int mailbox_get_url __P ((mailbox_t, url_t *));
extern int mailbox_set_url __P ((mailbox_t, url_t));
/* trace */
#define MU_MAILBOX_DEBUG_TRACE 1
#define MU_MAILBOX_DEBUG_PROT 2
extern int mailbox_set_debug_level __P ((mailbox_t mbox, size_t level));
extern int mailbox_get_debug_level __P ((mailbox_t mbox, size_t *plevel));
extern int mailbox_set_debug_print __P ((mailbox_t mbox, int (*debug_print)
__P ((void *arg, const char *,
size_t)),
void *arg));
/* For any debuging */
extern int mailbox_get_debug __P ((mailbox_t, debug_t *));
extern int mailbox_set_debug __P ((mailbox_t, debug_t));
/* Events. */
extern int mailbox_get_observable __P ((mailbox_t, observable_t *));
#ifdef __cplusplus
}
#endif
#endif /* _MAILBOX_H */
#endif /* _MAILUTILS_MAILBOX_H */
......
......@@ -15,10 +15,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _MAILER_H
#define _MAILER_H
#ifndef _MAILUTILS_MAILER_H
#define _MAILUTILS_MAILER_H
#include <sys/types.h>
#include <mailutils/stream.h>
#include <mailutils/observer.h>
#include <mailutils/debug.h>
#include <mailutils/url.h>
#include <mailutils/message.h>
#ifndef __P
......@@ -37,15 +41,29 @@ extern "C" {
struct _mailer;
typedef struct _mailer *mailer_t;
extern int mailer_create __P ((mailer_t *, message_t));
extern int mailer_destroy __P ((mailer_t *));
extern int mailer_connect __P ((mailer_t, char *host));
extern int mailer_disconnect __P ((mailer_t));
extern int mailer_send_header __P ((mailer_t, message_t));
extern int mailer_send_message __P ((mailer_t, message_t));
extern int mailer_create __P ((mailer_t *, const char *, int));
extern void mailer_destroy __P ((mailer_t *));
extern int mailer_open __P ((mailer_t, int flags));
extern int mailer_close __P ((mailer_t));
extern int mailer_send_message __P ((mailer_t, const char *from,
const char *rcpt, int dsn, message_t));
/* stream settings */
extern int mailer_get_stream __P ((mailer_t, stream_t *));
extern int mailer_set_stream __P ((mailer_t, stream_t));
/* stream settings */
extern int mailer_get_debug __P ((mailer_t, debug_t *));
extern int mailer_set_debug __P ((mailer_t, debug_t));
extern int mailer_attach __P ((mailer_t, observer_t));
extern int mailer_detach __P ((mailer_t, observer_t));
extern int mailer_get_url __P ((mailer_t, url_t *));
#ifdef _cplusplus
}
#endif
#endif /* _MAILER_H */
#endif /* _MAILUTILS_MAILER_H */
......
......@@ -15,14 +15,15 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _MESSAGE_H
#define _MESSAGE_H
#ifndef _MAILUTILS_MESSAGE_H
#define _MAILUTILS_MESSAGE_H
#include <sys/types.h>
#include <mailutils/stream.h>
#include <mailutils/header.h>
#include <mailutils/body.h>
#include <mailutils/observer.h>
#include <mailutils/attribute.h>
#include <mailutils/stream.h>
#ifndef __P
......@@ -47,6 +48,7 @@ typedef struct _message *message_t;
extern int message_create __P ((message_t *, void *owner));
extern void message_destroy __P ((message_t *, void *owner));
extern void * message_get_owner __P ((message_t));
extern int message_get_header __P ((message_t, header_t *));
extern int message_set_header __P ((message_t, header_t, void *owner));
......@@ -57,6 +59,11 @@ extern int message_set_body __P ((message_t, body_t, void *owner));
extern int message_get_stream __P ((message_t, stream_t *));
extern int message_set_stream __P ((message_t, stream_t, void *owner));
extern int message_get_attribute __P ((message_t, attribute_t *));
extern int message_set_attribute __P ((message_t, attribute_t, void *));
extern int message_get_observable __P ((message_t, observable_t *));
extern int message_is_multipart __P ((message_t, int *));
extern int message_set_is_multipart __P ((message_t, int (*_is_multipart)
__P ((message_t, int *)), void *));
......@@ -81,9 +88,6 @@ extern int message_set_received __P ((message_t, int (*_received)
__P ((message_t, char *, size_t,
size_t *)), void *owner));
extern int message_get_attribute __P ((message_t, attribute_t *));
extern int message_set_attribute __P ((message_t, attribute_t, void *));
extern int message_get_num_parts __P ((message_t, size_t *nparts));
extern int message_set_get_num_parts __P ((message_t, int (*_get_num_parts)
__P ((message_t, size_t *)),
......@@ -99,12 +103,6 @@ extern int message_set_uidl __P ((message_t, int (*_get_uidl)
__P ((message_t, char *, size_t,
size_t *)), void *owner));
/* events */
#define MU_EVT_MSG_DESTROY 32
extern int message_register __P ((message_t msg, size_t type, int (*action)
__P ((size_t typ, void *arg)), void *arg));
extern int message_deregister __P ((message_t msg, void *action));
/* misc functions */
extern int message_create_attachment __P ((const char *content_type,
const char *encoding,
......@@ -121,4 +119,4 @@ extern int message_unencapsulate __P ((message_t msg, message_t *newmsg,
}
#endif
#endif /* _MESSAGE_H */
#endif /* _MAILUTILS_MESSAGE_H */
......
......@@ -31,7 +31,10 @@
#endif /* __P */
/* mime flags */
#define MIME_INCREAMENTAL_PARSER 0x00000001
#define MIME_INCREAMENTAL_PARSER 0x1
#define MIME_MULTIPART_MIXED 0x1
#define MIME_MULTIPART_ALT 0x2
#ifdef _cplusplus
extern "C" {
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _OBSERVER_H
#define _OBSERVER_H
#include <sys/types.h>
#ifndef __P
#ifdef __STDC__
#define __P(args) args
#else
#define __P(args) ()
#endif
#endif /*__P */
#ifdef _cplusplus
extern "C" {
#endif
struct _observer;
struct _observable;
typedef struct _observer* observer_t;
typedef struct _observable* observable_t;
#define MU_EVT_MAILBOX_DESTROY 0x001
#define MU_EVT_MAILER_DESTROY 0x002
#define MU_EVT_MESSAGE_DESTROY 0x004
#define MU_EVT_MESSAGE_ADD 0x008
#define MU_EVT_MAILBOX_PROGRESS 0x010
#define MU_EVT_AUTHORITY_FAILED 0x020
#define MU_OBSERVER_NO_CHECK 1
extern int observer_create __P ((observer_t *, void *owner));
extern void observer_destroy __P ((observer_t *, void *owner));
extern void * observer_get_owner __P ((observer_t));
extern int observer_action __P ((observer_t, size_t type));
extern int observer_set_action __P ((observer_t, int (*_action) __P ((observer_t, size_t)), void *owner));
extern int observer_set_destroy __P ((observer_t, int (*_destroy) __P((observer_t)), void *owner));
extern int observer_set_flags __P ((observer_t, int flags));
extern int observable_create __P ((observable_t *, void *owner));
extern void observable_destroy __P ((observable_t *, void *owner));
extern void * observable_get_owner __P ((observable_t));
extern int observable_attach __P ((observable_t, observer_t observer));
extern int observable_detach __P ((observable_t, observer_t observer));
extern int observable_notify __P ((observable_t, int type));
#ifdef _cplusplus
}
#endif
#endif /* _OBSERVER_H */
......@@ -15,13 +15,15 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _REGISTRAR_H
#define _REGISTRAR_H
#ifndef _MAILUTILS_REGISTRAR_H
#define _MAILUTILS_REGISTRAR_H
#include <sys/types.h>
#include <mailutils/url.h>
#include <mailutils/mailbox.h>
#include <mailutils/mailer.h>
#include <mailutils/list.h>
#ifndef __P
# ifdef __STDC__
......@@ -35,39 +37,87 @@
extern "C" {
#endif
struct url_registrar
struct mailbox_entry;
typedef struct mailbox_entry* mailbox_entry_t;
struct mailer_entry;
typedef struct mailer_entry* mailer_entry_t;
struct _registrar_record;
typedef struct _registrar_record* registrar_record_t;
struct mailbox_entry
{
const char *scheme;
int (*_create) __P ((url_t *, const char * name));
void (*_destroy) __P ((url_t *));
int (*_url_init) __P ((url_t));
int (*_mailbox_init) __P ((mailbox_t));
};
struct mailbox_registrar
struct mailer_entry
{
const char *name;
int (*_create) __P ((mailbox_t *, const char *name));
void (*_destroy) __P ((mailbox_t *));
int (*_url_init) __P ((url_t));
int (*_mailer_init) __P ((mailer_t));
};
struct _registrar;
typedef struct _registrar* registrar_t;
/* mailbox registration */
extern int registrar_add __P ((struct url_registrar *ureg,
struct mailbox_registrar *mreg, int *id));
extern int registrar_remove __P ((int id));
extern int registrar_get __P ((int id, struct url_registrar **ureg,
struct mailbox_registrar **mreg));
extern int registrar_num __P ((size_t *num));
extern int registrar_get_entry __P ((size_t num, struct url_registrar **ureg,
struct mailbox_registrar **mreg,
int *id));
extern int registrar_list __P ((struct url_registrar **ureg,
struct mailbox_registrar **mreg,
int *id, registrar_t *reg));
struct _record;
typedef struct _record* record_t;
/* Registration. */
extern int registrar_get_list __P ((list_t *));
/* Record. */
extern int record_create __P ((record_t *, void *owner));
extern void record_destroy __P ((record_t *));
extern int record_is_scheme __P ((record_t, const char *));
extern int record_set_scheme __P ((record_t, const char *));
extern int record_set_is_scheme __P ((record_t, int (*_is_scheme)
__P ((const char *))));
extern int record_get_mailbox __P ((record_t, mailbox_entry_t *));
extern int record_set_mailbox __P ((record_t, mailbox_entry_t));
extern int record_set_get_mailbox __P ((record_t, int (*_get_mailbox)
__P ((mailbox_entry_t *))));
extern int record_get_mailer __P ((record_t, mailer_entry_t *));
extern int record_set_mailer __P ((record_t, mailer_entry_t));
extern int record_set_get_mailer __P ((record_t, int (*_get_mailer)
__P ((mailer_entry_t *))));
#define MU_POP_PORT 110
#define MU_POP_SCHEME "pop://"
#define MU_POP_SCHEME_LEN 6
extern int url_pop_init __P ((url_t));
extern mailbox_entry_t pop_entry;
extern record_t pop_record;
#define MU_MBOX_SCHEME "mbox:"
#define MU_MBOX_SCHEME_LEN 5
extern int url_mbox_init __P ((url_t));
extern mailbox_entry_t mbox_entry;
extern record_t mbox_record;
#define MU_FILE_SCHEME "file:"
#define MU_FILE_SCHEME_LEN 5
extern int url_file_init __P ((url_t));
extern mailbox_entry_t file_entry;
extern record_t file_record;
#define MU_PATH_SCHEME "/"
#define MU_PATH_SCHEME_LEN 1
extern int url_path_init __P ((url_t));
extern mailbox_entry_t path_entry;
extern record_t path_record;
#define MU_SMTP_SCHEME "smtp://"
#define MU_SMTP_SCHEME_LEN 7
#define MU_SMTP_PORT 25
extern int url_smtp_init __P ((url_t));
extern mailer_entry_t smtp_entry;
extern record_t smtp_record;
#define MU_SENDMAIL_SCHEME "sendmail:"
#define MU_SENDMAIL_SCHEME_LEN 9
extern int url_sendmail_init __P ((url_t));
extern mailer_entry_t sendmail_entry;
extern record_t sendmail_record;
#ifdef _cplusplus
}
#endif
#endif /* _REGISTRAR_H */
#endif /* _MAILUTILS_REGISTRAR_H */
......
......@@ -15,8 +15,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _STREAM_H
# define _STREAM_H
#ifndef _MAILUTILS_STREAM_H
# define _MAILUTILS_STREAM_H
#include <sys/types.h>
......@@ -44,11 +44,17 @@ typedef struct _stream *stream_t;
/* stream will be destroy on stream_destroy */
#define MU_STREAM_NO_CHECK 0x00000040
extern int stream_create __P ((stream_t *, int flags, void *owner));
/* Identity of the stream. */
#define MU_STREAM_POP 0x00001000
#define MU_STREAM_IMAP 0x00002000
#define MU_STREAM_FILE 0x00004000
#define MU_STREAM_SMTP 0x00008000
#define MU_STREAM_SENDMAIL 0x00010000
extern int stream_create __P ((stream_t *, int flags, void *owner));
extern void stream_destroy __P ((stream_t *, void *owner));
extern int stream_set_destroy __P ((stream_t, void (*_destroy)
__P ((stream_t)), void *owner));
extern int stream_set_destroy __P ((stream_t, void (*_destroy) __P ((stream_t)), void *owner));
extern void * stream_get_owner __P ((stream_t));
extern int stream_open __P ((stream_t, const char *, int, int));
extern int stream_set_open __P ((stream_t, int (*_open)
......@@ -97,7 +103,7 @@ extern int stream_set_flush __P ((stream_t, int (*_flush)
__P ((stream_t)), void *owner));
extern int stream_get_flags __P ((stream_t, int *pflags));
extern int stream_set_flags __P ((stream_t, int flags, void *owner));
extern int stream_set_flags __P ((stream_t, int flags));
#define MU_STREAM_STATE_OPEN 1
#define MU_STREAM_STATE_READ 2
......@@ -118,4 +124,4 @@ extern int tcp_stream_create __P ((stream_t *stream));
}
#endif
#endif /* _STREAM_H */
#endif /* _MAILUTILS_STREAM_H */
......
......@@ -15,8 +15,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _TRANSCODE_H
#define _TRANSCODE_H
#ifndef _MAILUTILS_TRANSCODE_H
#define _MAILUTILS_TRANSCODE_H
#include <sys/types.h>
......@@ -53,4 +53,4 @@ extern int transcode_set_stream __P ((transcoder_t tc, stream_t is));
}
#endif
#endif /* _TRANSCODE_H */
#endif /* _MAILUTILS_TRANSCODE_H */
......
......@@ -15,8 +15,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _URL_H
#define _URL_H 1
#ifndef _MAILUTILS_URL_H
#define _MAILUTILS_URL_H 1
#include <sys/types.h>
......@@ -39,30 +39,18 @@ typedef struct _url * url_t;
extern int url_create __P ((url_t *, const char *name));
extern void url_destroy __P ((url_t *));
extern int url_get_id __P ((const url_t, int *id));
extern int url_get_scheme __P ((const url_t, char *sch,
size_t, size_t *));
extern int url_get_user __P ((const url_t, char *usr,
size_t, size_t *));
extern int url_get_passwd __P ((const url_t, char *passwd,
size_t, size_t *));
extern int url_get_host __P ((const url_t, char *host,
size_t, size_t *));
extern int url_get_port __P ((const url_t, long *port));
extern int url_get_path __P ((const url_t, char *path,
size_t, size_t *));
extern int url_get_query __P ((const url_t, char *qeury,
size_t, size_t *));
extern int url_get_scheme __P ((const url_t, char *, size_t, size_t *));
extern int url_get_user __P ((const url_t, char *, size_t, size_t *));
extern int url_get_passwd __P ((const url_t, char *, size_t, size_t *));
extern int url_get_auth __P ((const url_t, char *, size_t, size_t *));
extern int url_get_host __P ((const url_t, char *, size_t, size_t *));
extern int url_get_port __P ((const url_t, long *));
extern int url_get_path __P ((const url_t, char *, size_t, size_t *));
extern int url_get_query __P ((const url_t, char *, size_t, size_t *));
extern const char* url_to_string __P ((const url_t));
#ifdef __cplusplus
}
#endif
#endif /* URL_H */
#endif /* _MAILUTILS_URL_H */
......