Commit 5d0c69dd 5d0c69dda796350e3798025cd50b491b80a2489b by Sergey Poznyakoff

Moved from mailbox/

1 parent 44b2eccc
Makefile
Makefile.in
## Process this file with GNU Automake to create Makefile.in
## Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
##
## GNU Mailutils is free software; you can redistribute it and/or
## modify it under the terms of the GNU General 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
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301 USA
noinst_HEADERS = \
address0.h \
attribute0.h \
amd.h \
auth0.h \
body0.h \
debug0.h \
envelope0.h \
filter0.h \
folder0.h \
header0.h \
iterator0.h \
imap0.h \
list0.h \
mailbox0.h \
mailer0.h \
message0.h \
mime0.h \
monitor0.h \
observer0.h \
property0.h \
registrar0.h \
stream0.h \
url0.h
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _ADDRESS0_H
#define _ADDRESS0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/address.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The data-structure representing an RFC822 MAILBOX. It may be
* one MAILBOX or a list of them, as found in an ADDRESS or
* a MAILBOX list (as found in a GROUP).
*
* Capitalized names are from RFC 822, section 6.1 (Address Syntax).
*/
struct _mu_address
{
char *addr;
/* the original string that this list of addresses was created
* from, only present at the head of the list */
char *comments;
/* the collection of comments stripped during parsing this MAILBOX */
char *personal;
/* the PHRASE portion of a MAILBOX, called the DISPLAY-NAME in drums */
char *email;
/* the ADDR-SPEC, the LOCAL-PART@DOMAIN */
char *local_part;
/* the LOCAL-PART of a MAILBOX */
char *domain;
/* the DOMAIN of a MAILBOX */
char *route;
/* the optional ROUTE in the ROUTE-ADDR form of MAILBOX */
/* size_t num; this didn't appear to be used anywhere... so I commented
it out, is that ok? -sam */
struct _mu_address *next;
};
#ifdef __cplusplus
}
#endif
#endif /* _ADDRESS0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002, 2003,
2004, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#define MAX_OPEN_STREAMS 16
/* Notifications ADD_MESG. */
#define DISPATCH_ADD_MSG(mbox,mhd) \
do \
{ \
int bailing = 0; \
mu_monitor_unlock (mbox->monitor); \
if (mbox->observable) \
bailing = mu_observable_notify (mbox->observable, MU_EVT_MESSAGE_ADD); \
if (bailing != 0) \
{ \
if (pcount) \
*pcount = (mhd)->msg_count; \
mu_locker_unlock (mbox->locker); \
return EINTR; \
} \
mu_monitor_wrlock (mbox->monitor); \
} while (0);
struct _amd_data;
struct _amd_message
{
mu_stream_t stream; /* Associated file stream */
mu_off_t body_start; /* Offset of body start in the message file */
mu_off_t body_end; /* Offset of body end (size of file, effectively)*/
int attr_flags; /* Attribute flags */
int deleted; /* Was the message originally deleted */
time_t mtime; /* Time of last modification */
size_t header_lines; /* Number of lines in the header part */
size_t body_lines; /* Number of lines in the body */
mu_message_t message; /* Corresponding mu_message_t */
struct _amd_data *amd; /* Back pointer. */
};
struct _amd_data
{
size_t msg_size; /* Size of struct _amd_message */
int (*msg_init_delivery) (struct _amd_data *, struct _amd_message *);
int (*msg_finish_delivery) (struct _amd_data *, struct _amd_message *);
void (*msg_free) (struct _amd_message *);
char *(*msg_file_name) (struct _amd_message *, int deleted);
int (*scan0) (mu_mailbox_t mailbox, size_t msgno, size_t *pcount,
int do_notify);
int (*msg_cmp) (struct _amd_message *, struct _amd_message *);
int (*message_uid) (mu_message_t msg, size_t *puid);
size_t (*next_uid) (struct _amd_data *mhd);
/* List of messages: */
size_t msg_count; /* number of messages in the list */
size_t msg_max; /* maximum message buffer capacity */
struct _amd_message **msg_array;
unsigned long uidvalidity;
char *name; /* Directory name */
/* Pool of open message streams */
struct _amd_message *msg_pool[MAX_OPEN_STREAMS];
int pool_first; /* Index to the first used entry in msg_pool */
int pool_last; /* Index to the first free entry in msg_pool */
time_t mtime; /* Time of last modification */
mu_mailbox_t mailbox; /* Back pointer. */
};
int amd_init_mailbox (mu_mailbox_t mailbox, size_t mhd_size,
struct _amd_data **pmhd);
int _amd_message_insert (struct _amd_data *mhd, struct _amd_message *msg);
int amd_message_stream_open (struct _amd_message *mhm);
void amd_message_stream_close (struct _amd_message *mhm);
void amd_cleanup (void *arg);
int amd_url_init (mu_url_t url, const char *scheme);
struct _amd_message *_amd_get_message (struct _amd_data *amd, size_t msgno);
int amd_msg_lookup (struct _amd_data *amd, struct _amd_message *msg,
size_t *pret);
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _ATTRIBUTE0_H
# define _ATTRIBUTE0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/attribute.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_attribute
{
void *owner;
int flags;
int user_flags;
int (*_get_flags) (mu_attribute_t, int *);
int (*_set_flags) (mu_attribute_t, int);
int (*_unset_flags) (mu_attribute_t, int);
};
#ifdef __cplusplus
}
#endif
#endif /* _ATTRIBUTE0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _AUTH0_H
#define _AUTH0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/auth.h>
#include <mailutils/list.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_ticket
{
void *owner;
char *challenge;
void *data;
int (*_pop) (mu_ticket_t, mu_url_t, const char *challenge, char **);
void (*_destroy) (mu_ticket_t);
};
struct _mu_authority
{
void *owner;
mu_ticket_t ticket;
mu_list_t auth_methods; /* list of int (*_authenticate) (mu_authority_t)s; */
};
struct _mu_wicket
{
char *filename;
int (*_get_ticket) (mu_wicket_t, const char *, const char *, mu_ticket_t *);
};
#ifdef __cplusplus
}
#endif
#endif /* _AUTH0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _BODY0_H
#define _BODY0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/stream.h>
#include <mailutils/body.h>
#include <stdio.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_body
{
void *owner;
char *filename;
mu_stream_t stream;
mu_stream_t fstream;
int flags;
int (*_size) (mu_body_t, size_t*);
int (*_lines) (mu_body_t, size_t*);
};
#ifdef __cplusplus
}
#endif
#endif /* _BODY0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _DEBUG0_H
#define _DEBUG0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/debug.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_debug
{
size_t level;
char *buffer;
size_t buflen;
void *owner;
int (*_print) (mu_debug_t, size_t level, const char *, va_list);
};
#ifdef __cplusplus
}
#endif
#endif /* _DEBUG0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _ENVELOPE0_H
#define _ENVELOPE0_H
#ifdef DMALLOC
#include <dmalloc.h>
#endif
#include <mailutils/envelope.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_envelope
{
void *owner;
int (*_destroy) (mu_envelope_t);
int (*_sender) (mu_envelope_t, char *, size_t, size_t*);
int (*_date) (mu_envelope_t, char *, size_t , size_t *);
};
#endif /* _ENVELOPE0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
/* Notes:
*/
#ifndef _FILTER0_H
#define _FILTER0_H
#include <mailutils/filter.h>
#include <mailutils/list.h>
#include <mailutils/monitor.h>
#include <mailutils/property.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_filter
{
mu_stream_t stream;
mu_stream_t filter_stream;
mu_property_t property;
int direction;
int type;
void *data;
int (*_read) (mu_filter_t, char *, size_t, mu_off_t, size_t *);
int (*_readline) (mu_filter_t, char *, size_t, mu_off_t, size_t *);
int (*_write) (mu_filter_t, const char *, size_t, mu_off_t, size_t *);
void (*_destroy) (mu_filter_t);
};
#ifdef __cplusplus
}
#endif
#endif /* _FILTER0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _FOLDER0_H
#define _FOLDER0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <sys/types.h>
#include <stdio.h>
#include <mailutils/monitor.h>
#include <mailutils/folder.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_folder
{
/* Data */
mu_authority_t authority;
mu_observable_t observable;
mu_debug_t debug;
mu_stream_t stream;
mu_monitor_t monitor;
mu_url_t url;
int flags;
int ref;
size_t uid;
/* Back pointer to the specific mailbox */
void *data;
/* Public methods */
void (*_destroy) (mu_folder_t);
int (*_open) (mu_folder_t, int flag);
int (*_close) (mu_folder_t);
int (*_list) (mu_folder_t, const char *, const char *,
size_t,
mu_list_t);
int (*_lsub) (mu_folder_t, const char *, const char *,
mu_list_t);
int (*_delete) (mu_folder_t, const char *);
int (*_rename) (mu_folder_t, const char *, const char *);
int (*_subscribe) (mu_folder_t, const char *);
int (*_unsubscribe) (mu_folder_t, const char *);
};
/* Moro(?)ic kluge. */
#define FOLDER_DEBUG0(folder, type, format) \
if (folder->debug) mu_debug_print (folder->debug, type, format)
#define FOLDER_DEBUG1(folder, type, format, arg1) \
if (folder->debug) mu_debug_print (folder->debug, type, format, arg1)
#define FOLDER_DEBUG2(folder, type, format, arg1, arg2) \
if (folder->debug) mu_debug_print (folder->debug, type, format, arg1, arg2)
#define FOLDER_DEBUG3(folder, type, format, arg1, arg2, arg3) \
if (folder->debug) mu_debug_print (folder->debug, type, format, arg1, arg2, arg3)
#define FOLDER_DEBUG4(folder, type, format, arg1, arg2, arg3, arg4) \
if (folder->debug) mu_debug_print (folder->debug, type, format, arg1, arg2, arg3, arg4)
#ifdef __cplusplus
}
#endif
#endif /* _FOLDER0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _HEADER0_H
#define _HEADER0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/header.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/* The structure members are offset that point to the begin/end of header
fields. */
struct _hdr
{
char *fn;
char *fn_end;
char *fv;
char *fv_end;
};
/* The blurb member represents the headers, hdr_count the number of distinct
header field and the layout is done by struct_hdr *hdr. */
struct _mu_header
{
/* Owner. */
void *owner;
/* Data. */
mu_stream_t mstream;
size_t stream_len;
char *blurb;
size_t blurb_len;
size_t hdr_count;
struct _hdr *hdr;
size_t fhdr_count;
struct _hdr *fhdr;
int flags;
/* Stream. */
mu_stream_t stream;
int (*_get_value) (mu_header_t, const char *, char *, size_t , size_t *);
int (*_get_fvalue) (mu_header_t, const char *, char *, size_t , size_t *);
int (*_set_value) (mu_header_t, const char *, const char *, int);
int (*_lines) (mu_header_t, size_t *);
int (*_size) (mu_header_t, size_t *);
int (*_fill) (mu_header_t, char *, size_t, mu_off_t, size_t *);
};
#ifdef __cplusplus
}
#endif
#endif /* _HEADER0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _IMAP0_H
#define _IMAP0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <folder0.h>
#include <mailbox0.h>
#include <registrar0.h>
#include <auth0.h>
#ifdef __cplusplus
extern "C" {
#endif
#define CLEAR_STATE(f_imap) \
f_imap->selected = NULL, f_imap->state = IMAP_NO_STATE
/* Clear the state and close the stream. */
#define CHECK_ERROR_CLOSE(folder, f_imap, status) \
do \
{ \
if (status != 0) \
{ \
mu_stream_close (folder->stream); \
CLEAR_STATE (f_imap); \
return status; \
} \
} \
while (0)
/* Clear the state. */
#define CHECK_ERROR(f_imap, status) \
do \
{ \
if (status != 0) \
{ \
CLEAR_STATE (f_imap); \
return status; \
} \
} \
while (0)
/* Clear the state for non recoverable error. */
#define CHECK_EAGAIN(f_imap, status) \
do \
{ \
if (status != 0) \
{ \
if (status != EAGAIN && status != EINPROGRESS && status != EINTR) \
{ \
CLEAR_STATE (f_imap); \
} \
return status; \
} \
} \
while (0)
struct _f_imap;
struct _m_imap;
struct _msg_imap;
typedef struct _f_imap *f_imap_t;
typedef struct _m_imap *m_imap_t;
typedef struct _msg_imap *msg_imap_t;
enum imap_state
{
IMAP_NO_STATE=0,
IMAP_AUTH, IMAP_AUTH_DONE,
IMAP_APPEND, IMAP_APPEND_CONT, IMAP_APPEND_SEND, IMAP_APPEND_ACK,
IMAP_BODY,
IMAP_CLOSE, IMAP_CLOSE_ACK,
IMAP_COPY, IMAP_COPY_ACK,
IMAP_CREATE, IMAP_CREATE_ACK,
IMAP_DELETE, IMAP_DELETE_ACK,
IMAP_EXPUNGE, IMAP_EXPUNGE_ACK,
IMAP_FETCH, IMAP_FETCH_ACK,
IMAP_GREETINGS,
IMAP_HEADER,
IMAP_HEADER_FIELD,
IMAP_LIST, IMAP_LIST_PARSE, IMAP_LIST_ACK,
IMAP_LOGIN, IMAP_LOGIN_ACK,
IMAP_LOGOUT, IMAP_LOGOUT_ACK,
IMAP_LSUB, IMAP_LSUB_ACK,
IMAP_MESSAGE,
IMAP_NOOP, IMAP_NOOP_ACK,
IMAP_OPEN_CONNECTION,
IMAP_RENAME, IMAP_RENAME_ACK,
IMAP_SCAN, IMAP_SCAN_ACK,
IMAP_SELECT, IMAP_SELECT_ACK,
IMAP_STORE, IMAP_STORE_ACK,
IMAP_SUBSCRIBE, IMAP_SUBSCRIBE_ACK,
IMAP_UNSUBSCRIBE, IMAP_UNSUBSCRIBE_ACK
};
enum imap_auth_state
{
/* ANONYMOUS */
IMAP_AUTH_ANON_REQ_WRITE,
IMAP_AUTH_ANON_REQ_SEND,
IMAP_AUTH_ANON_WAIT_CONT,
IMAP_AUTH_ANON_MSG,
IMAP_AUTH_ANON_MSG_SEND,
IMAP_AUTH_ANON_WAIT_RESP
};
struct literal_string
{
char *buffer;
size_t buflen;
size_t total;
msg_imap_t msg_imap;
enum imap_state type;
size_t nleft; /* nleft to read in the literal. */
};
struct _f_imap
{
/* Back pointer. */
mu_folder_t folder;
m_imap_t selected;
enum imap_state state;
size_t seq; /* Sequence number to build a tag. */
char **capav; /* Cabilities of the server. */
int capac; /* Number of capabilities in the above array */
int flags;
/* IO use to hold the literal and quoted strings send by
the IMAP server. */
struct
{
mu_stream_t stream;
mu_off_t offset;
size_t nleft; /* nleft to read in the literal. */
msg_imap_t msg_imap;
enum imap_state type;
} string;
/* Use for LIST and LSUB. */
mu_list_t flist;
int isopen;
/* Server channel buffer I/O */
size_t buflen;
char *buffer;
char *ptr;
char *nl;
mu_off_t offset; /* Dummy, this is used because of the stream buffering.
The mu_stream_t maintains and offset and the offset we use must
be in sync. */
/* Login */
char *user;
char *passwd;
/* AUTHENTICATE states */
enum imap_auth_state auth_state;
};
struct _m_imap
{
/* Back pointers. */
mu_mailbox_t mailbox;
f_imap_t f_imap;
size_t messages_count;
size_t imessages_count;
msg_imap_t *imessages;
size_t recent;
size_t unseen;
unsigned long uidvalidity;
size_t uidnext;
char *name;
enum imap_state state;
/* mailbox operations can be sequences of folder operations, and
thus need to keep meta-state, mailbox_imap_open(), for example. */
};
struct _msg_imap
{
/* Back pointers. */
mu_message_t message;
m_imap_t m_imap;
size_t num;
size_t part;
size_t num_parts;
msg_imap_t *parts;
msg_imap_t parent;
int flags;
size_t uid;
mu_header_t fheader;
char *internal_date;
size_t mu_message_size;
size_t mu_message_lines;
size_t body_size;
size_t body_lines;
size_t header_size;
size_t header_lines;
};
int imap_writeline (f_imap_t, const char *format, ...);
int imap_write (f_imap_t);
int imap_send (f_imap_t);
int imap_parse (f_imap_t);
int imap_readline (f_imap_t);
char *section_name (msg_imap_t);
#ifdef __cplusplus
}
#endif
#endif /* _IMAP0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _ITERATOR0_H
#define _ITERATOR0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/iterator.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_iterator
{
struct _mu_iterator *next_itr; /* Next iterator in the chain */
void *owner; /* Object whose contents is being iterated */
int is_advanced; /* Is the iterator already advanced */
int (*dup) (void **ptr, void *owner);
int (*destroy) (mu_iterator_t itr, void *owner);
int (*first) (void *owner);
int (*next) (void *owner);
int (*getitem) (void *owner, void **pret);
int (*curitem_p) (void *owner, void *item);
int (*finished_p) (void *owner);
};
#ifdef __cplusplus
}
#endif
#endif /* _ITERATOR0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _LIST0_H
#define _LIST0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <sys/types.h>
#include <mailutils/list.h>
#include <mailutils/monitor.h>
#include <mailutils/iterator.h>
#ifdef __cplusplus
extern "C" {
#endif
struct list_data
{
void *item;
struct list_data *next;
struct list_data *prev;
};
struct _mu_list
{
struct list_data head;
size_t count;
mu_monitor_t monitor;
mu_list_comparator_t comp;
void (*destroy_item) (void *item);
struct _mu_iterator *itr;
};
#ifdef __cplusplus
}
#endif
#endif /* _LIST0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _MAILBOX0_H
#define _MAILBOX0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <sys/types.h>
#include <stdio.h>
#include <mailutils/monitor.h>
#include <mailutils/mailbox.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_mailbox
{
/* Data */
mu_observable_t observable;
mu_debug_t debug;
mu_property_t property;
mu_locker_t locker;
mu_stream_t stream;
mu_url_t url;
int flags;
mu_folder_t folder;
mu_monitor_t monitor;
/* Back pointer to the specific mailbox */
void *data;
/* Public methods */
void (*_destroy) (mu_mailbox_t);
int (*_open) (mu_mailbox_t, int);
int (*_close) (mu_mailbox_t);
/* messages */
int (*_get_message) (mu_mailbox_t, size_t, mu_message_t *);
int (*_append_message) (mu_mailbox_t, mu_message_t);
int (*_messages_count) (mu_mailbox_t, size_t *);
int (*_messages_recent) (mu_mailbox_t, size_t *);
int (*_message_unseen) (mu_mailbox_t, size_t *);
int (*_expunge) (mu_mailbox_t);
int (*_save_attributes) (mu_mailbox_t);
int (*_uidvalidity) (mu_mailbox_t, unsigned long *);
int (*_uidnext) (mu_mailbox_t, size_t *);
int (*_get_property) (mu_mailbox_t, mu_property_t *);
int (*_scan) (mu_mailbox_t, size_t, size_t *);
int (*_is_updated) (mu_mailbox_t);
int (*_get_size) (mu_mailbox_t, mu_off_t *);
};
#define MAILBOX_NOTIFY(mbox, type) \
if (mbox->observer) observer_notify (mbox->observer, type)
/* Moro(?)ic kluge. */
#define MAILBOX_DEBUG0(mbox, type, format) \
if (mbox->debug) mu_debug_print (mbox->debug, type, format)
#define MAILBOX_DEBUG1(mbox, type, format, arg1) \
if (mbox->debug) mu_debug_print (mbox->debug, type, format, arg1)
#define MAILBOX_DEBUG2(mbox, type, format, arg1, arg2) \
if (mbox->debug) mu_debug_print (mbox->debug, type, format, arg1, arg2)
#define MAILBOX_DEBUG3(mbox, type, format, arg1, arg2, arg3) \
if (mbox->debug) mu_debug_print (mbox->debug, type, format, arg1, arg2, arg3)
#define MAILBOX_DEBUG4(mbox, type, format, arg1, arg2, arg3, arg4) \
if (mbox->debug) mu_debug_print (mbox->debug, type, format, arg1, arg2, arg3, arg4)
#ifdef __cplusplus
}
#endif
#endif /* _MAILBOX0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _MAILER0_H
#define _MAILER0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <sys/types.h>
#include <mailutils/mailer.h>
#include <mailutils/monitor.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Default mailer URL. */
#define MAILER_URL_DEFAULT "sendmail:"
#define MAILER_LINE_BUF_SIZE 1000
struct _mu_mailer
{
mu_stream_t stream;
mu_observable_t observable;
mu_debug_t debug;
mu_url_t url;
int flags;
mu_monitor_t monitor;
mu_property_t property;
/* Pointer to the specific mailer data. */
void *data;
/* Public methods. */
void (*_destroy) (mu_mailer_t);
int (*_open) (mu_mailer_t, int flags);
int (*_close) (mu_mailer_t);
int (*_send_message) (mu_mailer_t, mu_message_t, mu_address_t, mu_address_t);
};
#define MAILER_NOTIFY(mailer, type) \
if (mailer->observer) observer_notify (mailer->observer, type)
/* Moro(?)ic kluge. */
#define MAILER_DEBUGV(mailer, type, format, av) \
if (mailer->debug) mu_debug_print (mailer->debug, type, format, av)
#define MAILER_DEBUG0(mailer, type, format) \
if (mailer->debug) mu_debug_print (mailer->debug, type, format)
#define MAILER_DEBUG1(mailer, type, format, arg1) \
if (mailer->debug) mu_debug_print (mailer->debug, type, format, arg1)
#define MAILER_DEBUG2(mailer, type, format, arg1, arg2) \
if (mailer->debug) mu_debug_print (mailer->debug, type, format, arg1, arg2)
#define MAILER_DEBUG3(mailer, type, format, arg1, arg2, arg3) \
if (mailer->debug) mu_debug_print (mailer->debug, type, format, arg1, arg2, arg3)
#define MAILER_DEBUG4(mailer, type, format, arg1, arg2, arg3, arg4) \
if (mailer->debug) mu_debug_print (mailer->debug, type, format, arg1, arg2, arg3, arg4)
#ifdef __cplusplus
}
#endif
#endif /* MAILER0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _MESSAGE0_H
#define _MESSAGE0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/message.h>
#include <mailutils/mime.h>
#include <mailutils/monitor.h>
#include <sys/types.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_message
{
/* Who is the owner. */
void *owner;
mu_envelope_t envelope;
mu_header_t header;
mu_body_t body;
int flags;
mu_stream_t stream;
mu_attribute_t attribute;
mu_monitor_t monitor;
mu_mime_t mime;
mu_observable_t observable;
mu_mailbox_t mailbox;
/* Reference count. */
int ref;
/* Holder for message_write. */
size_t hdr_buflen;
int hdr_done;
int (*_get_uidl) (mu_message_t, char *, size_t, size_t *);
int (*_get_uid) (mu_message_t, size_t *);
int (*_get_num_parts) (mu_message_t, size_t *);
int (*_get_part) (mu_message_t, size_t, mu_message_t *);
int (*_is_multipart) (mu_message_t, int *);
int (*_lines) (mu_message_t, size_t *);
int (*_size) (mu_message_t, size_t *);
};
#ifdef __cplusplus
}
#endif
#endif /* _MESSAGE0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _MIME0_H
#define _MIME0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <sys/types.h>
#include <mailutils/mime.h>
#ifdef __cplusplus
extern "C" {
#endif
#define MIME_MAX_HDR_LEN 256
#define MIME_DFLT_BUF_SIZE 2048
/* Parser states */
#define MIME_STATE_BEGIN_LINE 1
#define MIME_STATE_SCAN_BOUNDARY 2
#define MIME_STATE_HEADERS 3
#define MIME_FLAG_MASK 0x0000ffff
/* private */
#define MIME_PARSER_ACTIVE 0x80000000
#define MIME_PARSER_HAVE_CR 0x40000000
#define MIME_NEW_MESSAGE 0x20000000
#define MIME_ADDED_CT 0x10000000
#define MIME_ADDED_MULTIPART_CT 0x08000000
#define MIME_INSERT_BOUNDARY 0x04000000
#define MIME_ADDING_BOUNDARY 0x02000000
struct _mu_mime
{
mu_message_t msg;
mu_header_t hdrs;
mu_stream_t stream;
int flags;
char *content_type;
int tparts;
int nmtp_parts;
struct _mime_part **mtp_parts; /* list of parts in the msg */
char *boundary;
int cur_offset;
int cur_part;
int part_offset;
int boundary_len;
int preamble;
int postamble;
/* parser state */
char *cur_line;
int line_ndx;
char *cur_buf;
int buf_size;
char *header_buf;
int header_buf_size;
int header_length;
int body_offset;
int body_length;
int body_lines;
int parser_state;
};
struct _mime_part
{
mu_mime_t mime;
mu_message_t msg;
int body_created;
int offset;
size_t len;
size_t lines;
};
#ifdef __cplusplus
}
#endif
#endif /* MIME0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _MONITOR0_H
#define _MONITOR0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <mailutils/monitor.h>
#ifdef __cplusplus
extern "C" {
#endif
/* FIXME: any protos? */
#ifdef __cplusplus
}
#endif
#endif /* _MONITOR0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _OBSERVER0_H
#define _OBSERVER0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/observer.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_observer
{
int flags;
void *owner;
int (*_action) (mu_observer_t, size_t);
int (*_destroy) (mu_observer_t);
};
struct _mu_observable
{
void *owner;
mu_list_t list;
};
struct _event
{
size_t type;
mu_observer_t observer;
};
typedef struct _event *event_t;
#ifdef __cplusplus
}
#endif
#endif /* _OBSERVER0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _PROPERTY0_H
#define _PROPERTY0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <mailutils/property.h>
#include <mailutils/monitor.h>
#ifdef __cplusplus
extern "C" {
#endif
struct property_item
{
char *key;
char *value;
int set;
struct property_item *next;
};
struct _mu_property
{
struct property_item *items;
void *owner;
mu_monitor_t lock;
};
#ifdef __cplusplus
}
#endif
#endif /* _PROPERTY0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2004, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _REGISTRAR0_H
#define _REGISTRAR0_H
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/registrar.h>
#ifdef __cplusplus
extern "C" {
#endif
/* The pop and imap defines are all wrong now, since they seem intertwined
with the old url parsing code. Also, "pop://" is not the POP scheme,
at least not as a scheme is described in the RFCs.
Perhaps they can be changed?
*/
#define MU_POP_PORT 110
#define MU_POP_SCHEME "pop://"
#define MU_POP_SCHEME_LEN (sizeof (MU_POP_SCHEME) - 1)
extern int _url_pop_init (mu_url_t);
extern int _mailbox_pop_init (mu_mailbox_t);
extern int _folder_pop_init (mu_folder_t);
#define MU_IMAP_PORT 143
#define MU_IMAP_SCHEME "imap://"
#define MU_IMAP_SCHEME_LEN (sizeof (MU_IMAP_SCHEME) - 1)
extern int _url_imap_init (mu_url_t);
extern int _mailbox_imap_init (mu_mailbox_t);
extern int _folder_imap_init (mu_folder_t);
#define MU_MBOX_SCHEME "mbox:"
#define MU_MBOX_SCHEME_LEN (sizeof (MU_MBOX_SCHEME) - 1)
extern int _url_mbox_init (mu_url_t);
extern int _mailbox_mbox_init (mu_mailbox_t);
extern int _folder_mbox_init (mu_folder_t);
#define MU_FILE_SCHEME "file:"
#define MU_FILE_SCHEME_LEN (sizeof (MU_FILE_SCHEME) - 1)
#define MU_PATH_SCHEME "/"
#define MU_PATH_SCHEME_LEN (sizeof (MU_PATH_SCHEME) - 1)
extern int _url_path_init (mu_url_t);
extern int _mailbox_path_init (mu_mailbox_t);
extern int _folder_path_init (mu_folder_t);
#define MU_SMTP_SCHEME "smtp://"
#define MU_SMTP_SCHEME_LEN (sizeof (MU_SMTP_SCHEME) - 1)
#define MU_SMTP_PORT 25
extern int _url_smtp_init (mu_url_t);
extern int _mailer_smtp_init (mu_mailer_t);
#define MU_SENDMAIL_SCHEME "sendmail:"
#define MU_SENDMAIL_SCHEME_LEN (sizeof (MU_SENDMAIL_SCHEME) - 1)
extern int _url_sendmail_init (mu_url_t);
extern int _mailer_sendmail_init (mu_mailer_t);
#define MU_MH_SCHEME "mh:"
#define MU_MH_SCHEME_LEN (sizeof (MU_MH_SCHEME) - 1)
extern int _mailbox_mh_init (mu_mailbox_t mailbox);
#define MU_MAILDIR_SCHEME "maildir:"
#define MU_MAILDIR_SCHEME_LEN (sizeof (MU_MAILDIR_SCHEME) - 1)
extern int _mailbox_maildir_init (mu_mailbox_t mailbox);
#ifdef __cplusplus
}
#endif
#endif /* _REGISTRAR0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _STREAM0_H
#define _STREAM0_H
#include <mailutils/stream.h>
#ifdef DMALLOC
#include <dmalloc.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Read buffer */
struct rbuffer
{
char *base;
char *ptr;
size_t count;
size_t bufsiz;
mu_off_t offset;
};
struct _mu_stream
{
void *owner;
mu_property_t property;
int flags;
int state;
/* Read space */
struct rbuffer rbuffer;
/* Stream pointer for sequential offset. */
mu_off_t offset;
void (*_destroy) (mu_stream_t);
int (*_open) (mu_stream_t);
int (*_close) (mu_stream_t);
int (*_get_transport2) (mu_stream_t, mu_transport_t *, mu_transport_t *);
int (*_read) (mu_stream_t, char *, size_t, mu_off_t, size_t *);
int (*_readline) (mu_stream_t, char *, size_t, mu_off_t, size_t *);
int (*_write) (mu_stream_t, const char *, size_t, mu_off_t, size_t *);
int (*_truncate) (mu_stream_t, mu_off_t);
int (*_size) (mu_stream_t, mu_off_t *);
int (*_flush) (mu_stream_t);
int (*_setbufsiz)(mu_stream_t, size_t);
int (*_strerror) (mu_stream_t, const char **);
int (*_wait) (mu_stream_t, int *pflags, struct timeval *tvp);
};
#ifdef __cplusplus
}
#endif
#endif /* _STREAM0_H */
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _URL0_H
#define _URL0_H 1
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <mailutils/url.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _mu_url
{
/* Data */
char *name;
char *scheme;
char *user;
char *passwd;
char *auth;
char *host;
long port;
char *path;
char *query;
void *data;
void (*_destroy) (mu_url_t url);
/* Methods */
int (*_get_scheme) (const mu_url_t, char *, size_t, size_t *);
int (*_get_user) (const mu_url_t, char *, size_t, size_t *);
int (*_get_passwd) (const mu_url_t, char *, size_t, size_t *);
int (*_get_auth) (const mu_url_t, char *, size_t, size_t *);
int (*_get_host) (const mu_url_t, char *, size_t, size_t *);
int (*_get_port) (const mu_url_t, long *);
int (*_get_path) (const mu_url_t, char *, size_t, size_t *);
int (*_get_query) (const mu_url_t, char *, size_t, size_t *);
};
#ifdef __cplusplus
}
#endif
#endif /* URL_H */