## modules/ep/mail_parser.h

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

## FUNCTIONS

This source file includes following functions.

1. EP_HasContent

       1 /***************************************
       2   $Revision: 1.17 $
       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                              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;
      52
      53 /* Whole container for a detailed description of a parsed mail message */
      54
      55 typedef struct MailHeader_Field *Mail_Header_FieldPtr;
      56 typedef struct MailHeader_Field {
      57   char* field;
      58   Mail_Header_FieldPtr next;
      59 } Mail_Header_Field;
      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;
      71
      72 typedef EP_Mail_Descr *EP_Mail_DescrPtr;
      73
      74 typedef short t_MM_type;
      75 typedef unsigned int u32;
      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;
      88
      89 #define EP_HasContent(node) (node->inner == NULL ? 1 : 0)
         /* [<][>][^][v][top][bottom][index][help] */
      90
      91 typedef enum {
      92   vS_IS_VALID = 0,
      93   vS_IS_NOT_PGP,
      94   vS_KO,
      95   vS_CRC_ERROR,
      96   vS_NO_PUBLIC_KEY,
      97   vS_NO_OPENPGP_DATA,
      98   vS_NO_IN_FILES,
      99   vS_NO_OUT_FILES,
     100   vS_TO_BE_PGPVERIFIED,
     101   vS_UNABLE_TO_WRITE_FILE,
     102   vS_UNMATCHED_PGP_DELIMITERS
     103 } verifySignatureRCs;
     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;
     109 typedef struct EP_TokenKeys *EPTokenKeysPtr;
     110
     111 typedef struct EP_Token {
     112   t_MM_type MIMEContentType;
     113   char      *file;
     114   EPTokenKeysPtr keys;
     115   EPTokenPtr next;
     116   EPTokenPtr prev;
     117 } EPToken;
     118
     119 typedef struct EP_TokenKeys {
     120   short     isValidPGPSignature;
     121   u32       keyID;
     122   EPTokenKeysPtr next;
     123 } EPTokenKeys;
     124
     125
     126 #ifdef __cplusplus
     127 extern "C" {
     128 #endif
     129
     130 EP_Mail_DescrPtr EP_ParseMail(   const char *inputFile,
     131                                  const char *outputPath,
     132                                  const char *keyRing,
     133                                  const char *gpgcmd);
     134 EPNodePtr EP_ParseText(          const char *inputFile,
     135                                  const char *outputPath,
     136                                  const char *keyRing,
     137                                  const char *gpgcmd);
     138 EPNodePtr EP_MIMEParse(          const EPNodePtr p);
     139 EPNodePtr EP_InitializeRootNode( const char *inputFile );
     140 EPNodePtr EP_InitializeNode(     const char *inputFile,
     141                                  const int nodeID );
     142 EPNodePtr EP_DefineNewNode(      const int nodeID,
     143                                  const short isValidPGPSignature,
     144                                  const t_MM_type MIMEContentType,
     145                                  const char *strMIMEContentType,
     146                                  const u32       keyID);
     147 void EP_TreeCleanUp(             const EPNodePtr ptr);
     148 void EP_MailDescrCleanUp(        const EP_Mail_DescrPtr ptr);
     149 void EP_BuildFilename(           const EPNodePtr ptr);
     150 void EP_ShowTree(                const EPNodePtr p);
     151 EPTokenPtr EP_GetTokens(const EPNodePtr p, const EPTokenPtr prev,
     152                         EPTokenKeysPtr keysList);
     153 void EP_PrintTokens(EPTokenPtr head);
     154 void EP_CleanTokens(const EPTokenPtr head);
     155
     156 #ifdef __cplusplus
     157 }
     158 #endif
     159
     160 #endif /* _MAIL_PARSER_H */

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