## modules/ep/mail_parser.h

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

## FUNCTIONS

This source file includes following functions.

1. EP_HasContent

       1 /***************************************
       2   $Revision: 1.15 $
       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
      47 /* FP : global objects used as and interface with gnuPG */
      48
      49 /* Pointer to a node of the parsing results tree */
      50 typedef struct EPNode *EPNodePtr;
      51
      52 /* Whole container for a detailed description of a parsed mail message */
      53
      54 typedef struct MailHeader_Field *Mail_Header_FieldPtr;
      55 typedef struct MailHeader_Field {
      56   char* field;
      57   Mail_Header_FieldPtr next;
      58 } Mail_Header_Field;
      59
      60 typedef struct Mail_Descr {
      61   Mail_Header_Field *from;
      62   Mail_Header_Field *subject;
      63   Mail_Header_Field *date;
      64   Mail_Header_Field *message_id;
      65   Mail_Header_Field *reply_to;
      66   Mail_Header_Field *cc;
      67   Mail_Header_Field *content_type;
      68   EPNodePtr tree;
      69 } EP_Mail_Descr;
      70
      71 typedef EP_Mail_Descr *EP_Mail_DescrPtr;
      72
      73 typedef short t_MM_type;
      74 typedef unsigned int u32;
      75
      76 /* The actual node describing a stage of the parsing process */
      77 typedef struct EPNode {
      78   int       nodeID;
      79   short     isValidPGPSignature;
      80   t_MM_type MIMEContentType;
      81   char      *strMIMEContentType;
      82   u32       keyID;
      83   char      *file;
      84   EPNodePtr inner;
      85   EPNodePtr next;
      86 } EP_mail_node;
      87
      88 #define EP_HasContent(node) (node->inner == NULL ? 1 : 0)
         /* [<][>][^][v][top][bottom][index][help] */
      89
      90 typedef enum {
      91   vS_IS_VALID = 0,
      92   vS_IS_NOT_PGP,
      93   vS_KO,
      94   vS_CRC_ERROR,
      95   vS_NO_PUBLIC_KEY,
      96   vS_NO_OPENPGP_DATA,
      97   vS_NO_IN_FILES,
      98   vS_NO_OUT_FILES,
      99   vS_TO_BE_PGPVERIFIED,
     100   vS_UNABLE_TO_WRITE_FILE,
     101   vS_UNMATCHED_PGP_DELIMITERS
     102 } verifySignatureRCs;
     103
     104 /* Tokens are leaves of the parsing tree and thir related
     105    informations, Such as: list of keys and deepest level MIME type */
     106
     107 typedef struct EP_Token *EPTokenPtr;
     108 typedef struct EP_TokenKeys *EPTokenKeysPtr;
     109
     110 typedef struct EP_Token {
     111   t_MM_type MIMEContentType;
     112   char      *file;
     113   EPTokenKeysPtr keys;
     114   EPTokenPtr next;
     115   EPTokenPtr prev;
     116 } EPToken;
     117
     118 typedef struct EP_TokenKeys {
     119   short     isValidPGPSignature;
     120   u32       keyID;
     121   EPTokenKeysPtr next;
     122 } EPTokenKeys;
     123
     124
     125 #ifdef __cplusplus
     126 extern "C" {
     127 #endif
     128
     129 EP_Mail_DescrPtr EP_ParseMail(   const char *inputFile,
     130                                  const char *outputPath,
     131                                  const char *keyRing);
     132 EPNodePtr EP_ParseText(          const char *inputFile,
     133                                  const char *outputPath,
     134                                  const char *keyRing);
     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);
     150 void EP_PrintTokens(EPTokenPtr head);
     151 void EP_CleanTokens(const EPTokenPtr head);
     152
     153 #ifdef __cplusplus
     154 }
     155 #endif
     156
     157 #endif

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