1 /* imap_proxy.h - IMAP proxy support functions 2 * 3 * Copyright (c) 1994-2008 Carnegie Mellon University. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in 14 * the documentation and/or other materials provided with the 15 * distribution. 16 * 17 * 3. The name "Carnegie Mellon University" must not be used to 18 * endorse or promote products derived from this software without 19 * prior written permission. For permission or any legal 20 * details, please contact 21 * Carnegie Mellon University 22 * Center for Technology Transfer and Enterprise Creation 23 * 4615 Forbes Avenue 24 * Suite 302 25 * Pittsburgh, PA 15213 26 * (412) 268-7393, fax: (412) 268-7395 27 * innovation@andrew.cmu.edu 28 * 29 * 4. Redistributions of any form whatsoever must retain the following 30 * acknowledgment: 31 * "This product includes software developed by Computing Services 32 * at Carnegie Mellon University (http://www.cmu.edu/computing/)." 33 * 34 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO 35 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 36 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE 37 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 38 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 39 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 40 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 41 */ 42 43 #ifndef _IMAP_PROXY_H 44 #define _IMAP_PROXY_H 45 46 #include "annotate.h" 47 #include "backend.h" 48 #include "imapurl.h" 49 #include "strarray.h" 50 51 enum { 52 PROXY_NOCONNECTION = -1, 53 PROXY_OK = 0, 54 PROXY_NO = 1, 55 PROXY_BAD = 2 56 }; 57 58 enum { 59 /* IMAP capabilities */ 60 CAPA_IDLE = (1 << 3), 61 CAPA_MUPDATE = (1 << 4), 62 CAPA_MULTIAPPEND = (1 << 5), 63 CAPA_ACLRIGHTS = (1 << 6), 64 CAPA_LISTEXTENDED = (1 << 7), 65 CAPA_SASL_IR = (1 << 8), 66 CAPA_REPLICATION = (1 << 9), 67 CAPA_METADATA = (1 << 10) 68 }; 69 70 extern struct protocol_t imap_protocol; 71 72 void proxy_gentag(char *tag, size_t len); 73 74 struct backend *proxy_findinboxserver(const char *userid); 75 76 int pipe_until_tag(struct backend *s, const char *tag, int force_notfatal); 77 int pipe_including_tag(struct backend *s, const char *tag, int force_notfatal); 78 int pipe_command(struct backend *s, int optimistic_literal); 79 int pipe_lsub(struct backend *s, const char *userid, const char *tag, 80 int force_notfatal, struct listargs *listargs, strarray_t *subs); 81 82 void print_listresponse(unsigned cmd, const char *extname, char hier_sep, 83 uint32_t attributes, struct buf *extraflags); 84 85 void proxy_copy(const char *tag, char *sequence, char *name, int myrights, 86 int usinguid, struct backend *s); 87 88 int proxy_catenate_url(struct backend *s, struct imapurl *url, FILE *f, 89 unsigned long *size, const char **parseerr); 90 91 int annotate_fetch_proxy(const char *server, const char *mbox_pat, 92 const strarray_t *entry_pat, 93 const strarray_t *attribute_pat); 94 int annotate_store_proxy(const char *server, const char *mbox_pat, 95 struct entryattlist *entryatts); 96 char *find_free_server(void); 97 #endif /* _IMAP_PROXY_H */ 98