## modules/ep/mail_parser.h

/* [<][>][^][v][top][bottom][index][help] */

## DEFINITIONS

This source file includes following functions.

1. EPNodePtr
2. Mail_Header_FieldPtr
3. Mail_Header_Field
4. EP_Mail_Descr
5. EP_Mail_DescrPtr
6. t_MM_type
7. u32
8. EP_mail_node
9. vS_IS_VALID
10. vS_IS_NOT_PGP
11. vS_KO
12. vS_CRC_ERROR
13. vS_NO_PUBLIC_KEY
14. vS_NO_OPENPGP_DATA
15. vS_NO_IN_FILES
16. vS_NO_OUT_FILES
17. vS_TO_BE_PGPVERIFIED
18. vS_UNABLE_TO_WRITE_FILE
19. vS_UNMATCHED_PGP_DELIMITERS
20. verifySignatureRCs
21. EPTokenPtr
22. EPTokenKeysPtr
23. EPToken
24. EPTokenKeys

       1 /***************************************
       2   $Revision: 1.20 $
       3
       4   Email Parser module (ep) - wrapping functions to parse email,
       5   calling MM and PA. Header file.
       6
       7   Status: NOT REVUED, TESTED
       8
       9   ******************/ /******************
      10   Filename            : mail_parser.h
      11   Authors             : filippo@ripe.net
      12   OSs Tested          : Solaris 7
      13   ******************/ /******************
      14   Copyright (c) 2000,2001,2002                    RIPE NCC
      15
      16   All Rights Reserved
      17
      18   Permission to use, copy, modify, and distribute this software and its
      19   documentation for any purpose and without fee is hereby granted,
      20   provided that the above copyright notice appear in all copies and that
      21   both that copyright notice and this permission notice appear in
      22   supporting documentation, and that the name of the author not be
      23   used in advertising or publicity pertaining to distribution of the
      24   software without specific, written prior permission.
      25
      26   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
      27   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
      28   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
      29   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
      30   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
      31   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
      32   ***************************************/
      33
      34 #ifndef _MAIL_PARSER_H
      35 #define _MAIL_PARSER_H
      36
      37 /* FP: interface file for EP module */
      38
      39 #define LINE_LENGTH 1024
      40 #define STRING_LENGTH 255
      41 #define FILENAME_LENGTH 1024
      42
      43 #define ERRSTRING strerror (errno)
      44
      45 #include "gpg.h"
      46 #include "memwrap.h"
      47
      48 /* FP : global objects used as and interface with gnuPG */
      49
      50 /* Pointer to a node of the parsing results tree */
      51 typedef struct EPNode *EPNodePtr;
         /* [<][>][^][v][top][bottom][index][help] */
      52
      53 /* Whole container for a detailed description of a parsed mail message */
      54
      55 typedef struct MailHeader_Field *Mail_Header_FieldPtr;
         /* [<][>][^][v][top][bottom][index][help] */
      56 typedef struct MailHeader_Field {
      57   char* field;
      58   Mail_Header_FieldPtr next;
      59 } Mail_Header_Field;
         /* [<][>][^][v][top][bottom][index][help] */
      60
      61 typedef struct Mail_Descr {
      62   Mail_Header_Field *from;
      63   Mail_Header_Field *subject;
      64   Mail_Header_Field *date;
      65   Mail_Header_Field *message_id;
      66   Mail_Header_Field *reply_to;
      67   Mail_Header_Field *cc;
      68   Mail_Header_Field *content_type;
      69   EPNodePtr tree;
      70 } EP_Mail_Descr;
         /* [<][>][^][v][top][bottom][index][help] */
      71
      72 typedef EP_Mail_Descr *EP_Mail_DescrPtr;
         /* [<][>][^][v][top][bottom][index][help] */
      73
      74 typedef short t_MM_type;
         /* [<][>][^][v][top][bottom][index][help] */
      75 typedef unsigned int u32;
         /* [<][>][^][v][top][bottom][index][help] */
      76
      77 /* The actual node describing a stage of the parsing process */
      78 typedef struct EPNode {
      79   int       nodeID;
      80   short     isValidPGPSignature;
      81   t_MM_type MIMEContentType;
      82   char      *strMIMEContentType;
      83   u32       keyID;
      84   char      *file;
      85   EPNodePtr inner;
      86   EPNodePtr next;
      87 } EP_mail_node;
         /* [<][>][^][v][top][bottom][index][help] */
      88
      89 #define EP_HasContent(node) (node->inner == NULL ? 1 : 0)
      90
      91 typedef enum {
      92   vS_IS_VALID = 0,
         /* [<][>][^][v][top][bottom][index][help] */
      93   vS_IS_NOT_PGP,
         /* [<][>][^][v][top][bottom][index][help] */
      94   vS_KO,
         /* [<][>][^][v][top][bottom][index][help] */
      95   vS_CRC_ERROR,
         /* [<][>][^][v][top][bottom][index][help] */
      96   vS_NO_PUBLIC_KEY,
         /* [<][>][^][v][top][bottom][index][help] */
      97   vS_NO_OPENPGP_DATA,
         /* [<][>][^][v][top][bottom][index][help] */
      98   vS_NO_IN_FILES,
         /* [<][>][^][v][top][bottom][index][help] */
      99   vS_NO_OUT_FILES,
         /* [<][>][^][v][top][bottom][index][help] */
     100   vS_TO_BE_PGPVERIFIED,
         /* [<][>][^][v][top][bottom][index][help] */
     101   vS_UNABLE_TO_WRITE_FILE,
         /* [<][>][^][v][top][bottom][index][help] */
     102   vS_UNMATCHED_PGP_DELIMITERS
         /* [<][>][^][v][top][bottom][index][help] */
     103 } verifySignatureRCs;
         /* [<][>][^][v][top][bottom][index][help] */
     104
     105 /* Tokens are leaves of the parsing tree and thir related
     106    informations, Such as: list of keys and deepest level MIME type */
     107
     108 typedef struct EP_Token *EPTokenPtr;
         /* [<][>][^][v][top][bottom][index][help] */
     109 typedef struct EP_TokenKeys *EPTokenKeysPtr;
         /* [<][>][^][v][top][bottom][index][help] */
     110
     111 typedef struct EP_Token {
     112   t_MM_type MIMEContentType;
     113   char      *file;
     114   EPTokenKeysPtr keys;
     115   EPTokenPtr next;
     116   EPTokenPtr prev;
     117   GSList     *passwords;
     118 } EPToken;
         /* [<][>][^][v][top][bottom][index][help] */
     119
     120 typedef struct EP_TokenKeys {
     121   short     isValidPGPSignature;
     122   u32       keyID;
     123   EPTokenKeysPtr next;
     124 } EPTokenKeys;
         /* [<][>][^][v][top][bottom][index][help] */
     125
     126
     127 #ifdef __cplusplus
     128 extern "C" {
     129 #endif
     130
     131 EP_Mail_DescrPtr EP_ParseMail(   const char *inputFile,
     132                                  const char *outputPath);
     133 EPNodePtr EP_ParseText(          const char *inputFile,
     134                                  const char *outputPath);
     135 EPNodePtr EP_MIMEParse(          const EPNodePtr p);
     136 EPNodePtr EP_InitializeRootNode( const char *inputFile );
     137 EPNodePtr EP_InitializeNode(     const char *inputFile,
     138                                  const int nodeID );
     139 EPNodePtr EP_DefineNewNode(      const int nodeID,
     140                                  const short isValidPGPSignature,
     141                                  const t_MM_type MIMEContentType,
     142                                  const char *strMIMEContentType,
     143                                  const u32       keyID);
     144 void EP_TreeCleanUp(             const EPNodePtr ptr);
     145 void EP_MailDescrCleanUp(        const EP_Mail_DescrPtr ptr);
     146 void EP_BuildFilename(           const EPNodePtr ptr);
     147 void EP_ShowTree(                const EPNodePtr p);
     148 EPTokenPtr EP_GetTokens(const EPNodePtr p, const EPTokenPtr prev,
     149                         EPTokenKeysPtr keysList, GSList *passwords);
     150 void EP_PrintTokens(EPTokenPtr head);
     151 void EP_CleanTokens(const EPTokenPtr head);
     152
     153 #ifdef __cplusplus
     154 }
     155 #endif
     156
     157 #endif /* _MAIL_PARSER_H */

/* [<][>][^][v][top][bottom][index][help] */