1 /* 2 * Copyright (c) 2006-2009 Internet Initiative Japan Inc. All rights reserved. 3 * 4 * The terms and conditions of the accompanying program 5 * shall be provided separately by Internet Initiative Japan Inc. 6 * Any use, reproduction or distribution of the program are permitted 7 * provided that you agree to be bound to such terms and conditions. 8 * 9 * $Id: inetmailbox.h 1269 2009-11-20 02:28:29Z takahiko $ 10 */ 11 12 #ifndef __INET_MAILBOX_H__ 13 #define __INET_MAILBOX_H__ 14 15 #include <stdbool.h> 16 #include "xbuffer.h" 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 typedef struct InetMailbox InetMailbox; 23 24 typedef InetMailbox *(*InetMailbox_builder)(const char *head, const char *tail, const char **nextp, const char **errptr); 25 26 extern InetMailbox *InetMailbox_buildWithLength(const char *localpart, size_t localpart_len, 27 const char *domain, size_t domain_len); 28 extern InetMailbox *InetMailbox_build(const char *localpart, const char *domain); 29 extern InetMailbox *InetMailbox_duplicate(const InetMailbox *mailbox); 30 extern InetMailbox *InetMailbox_buildDkimIdentity(const char *head, const char *tail, 31 const char **nextp, const char **errptr); 32 extern InetMailbox *InetMailbox_build2821Mailbox(const char *head, const char *tail, 33 const char **nextp, const char **errptr); 34 extern InetMailbox *InetMailbox_build2821Path(const char *head, const char *tail, 35 const char **nextp, const char **errptr); 36 extern InetMailbox *InetMailbox_build2821ReversePath(const char *head, const char *tail, 37 const char **nextp, const char **errptr); 38 extern InetMailbox *InetMailbox_build2822Mailbox(const char *head, const char *tail, 39 const char **nextp, const char **errptr); 40 extern const char *InetMailbox_getLocalPart(const InetMailbox *self); 41 extern const char *InetMailbox_getDomain(const InetMailbox *self); 42 extern bool InetMailbox_isNullAddr(const InetMailbox *self); 43 extern void InetMailbox_free(InetMailbox *self); 44 extern size_t InetMailbox_getRawAddrLength(const InetMailbox *self); 45 extern int InetMailbox_writeRawAddr(const InetMailbox *self, XBuffer *xbuf); 46 extern bool InetMailbox_isLocalPartQuoted(const InetMailbox *self); 47 extern int InetMailbox_writeAddrSpec(const InetMailbox *self, XBuffer *xbuf); 48 extern int InetMailbox_writeMailbox(const InetMailbox *self, XBuffer *xbuf); 49 50 extern InetMailbox *InetMailbox_buildSendmailPath(const char *head, const char *tail, 51 const char **nextp, const char **errptr); 52 extern InetMailbox *InetMailbox_buildSendmailReversePath(const char *head, const char *tail, 53 const char **nextp, const char **errptr); 54 55 #ifdef __cplusplus 56 } 57 #endif 58 59 #endif /* __INET_MAILBOX_H__ */ 60