Back to index

courier  0.68.2
imaptoken.h
Go to the documentation of this file.
00001 #ifndef       imaptoken_h
00002 #define       imaptoken_h
00003 
00004 /*
00005 ** Copyright 1998 - 2003 Double Precision, Inc.
00006 ** See COPYING for distribution information.
00007 */
00008 
00009 #include      <stdio.h>
00010 #include      <stdlib.h>
00011 #include      <time.h>
00012 
00013 
00014 struct imaptoken {
00015        short  tokentype;
00016        unsigned long tokennum;
00017        char *tokenbuf;
00018        size_t tokenbuf_size;
00019        } ;
00020 
00021 #define       IT_ATOM                     0
00022 #define       IT_NUMBER            1
00023 #define       IT_QUOTED_STRING     2
00024 #define       IT_LITERAL_STRING_START     3
00025 #define       IT_LPAREN            4
00026 #define       IT_RPAREN            5
00027 #define       IT_NIL               6
00028 #define       IT_ERROR             7
00029 #define       IT_EOL               8
00030 #define       IT_LBRACKET          9
00031 #define       IT_RBRACKET          10
00032 
00033 struct imaptoken *nexttoken(void);
00034 struct imaptoken *currenttoken(void);
00035 struct imaptoken *nexttoken_nouc(void);
00036 struct imaptoken *nexttoken_noparseliteral(void);
00037 struct imaptoken *nexttoken_okbracket(void);
00038 struct imaptoken *nexttoken_nouc_okbracket(void);
00039 
00040 int ismsgset(struct imaptoken *);
00041        /* See if this token is a syntactically valid message set */
00042 int ismsgset_str(const char *);
00043        /* Ditto */
00044 
00045 void read_timeout(time_t);
00046 void read_eol();
00047 void unread(int);
00048 
00049 extern size_t doread(char *buf, size_t bufsiz);
00050 extern char *imap_readptr;
00051 extern size_t imap_readptrleft;
00052 extern void readfill();
00053 
00054 #define       READ() ( imap_readptrleft ? \
00055        (--imap_readptrleft, (int)(unsigned char)*imap_readptr++): \
00056        (readfill(), --imap_readptrleft, (int)(unsigned char)*imap_readptr++))
00057 
00058 void read_string(char **, unsigned long *, unsigned long);
00059 
00060 /* Flags */
00061 
00062 struct imapflags {
00063        char   seen;
00064        char   answered;
00065        char   deleted;
00066        char   flagged;
00067        char   drafts;
00068        char   recent;
00069        } ;
00070 
00071 struct imapkeywords {
00072        struct imapflags flags;
00073 
00074        struct imapkeyword *first_keyword, *last_keyword;
00075 };
00076 
00077 /* ATOMS have the following maximum length */
00078 
00079 #define       IT_MAX_ATOM_SIZE     16384
00080 
00081 char *my_strdup(const char *s);
00082 
00083 
00084 /* SMAP */
00085 
00086 void smap_readline(char *buffer, size_t bufsize);
00087 
00088 #endif