1 | /*************************************** 2 | $Revision: 1.2 $ 3 | 4 | Subject line parsing 5 | 6 | Status: NOT REVIEWED, TESTED 7 | 8 | Author(s): Engin Gunduz 9 | 10 | ******************/ /****************** 11 | Modification History: 12 | engin (19/03/2001) Created. 13 | ******************/ /****************** 14 | Copyright (c) 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 UP_SUBJECT_H 35 | #define UP_SUBJECT_H 36 | 37 | #include <stdio.h> 38 | #include <stdlib.h> 39 | #include <string.h> 40 | #include <sys/types.h> 41 | #include <glib.h> 42 | 43 | enum UP_KEYW_CLASSIFICATION{ 44 | UP_KEYWORD_HELP = 0, /* HELP or HOWTO */ 45 | UP_KEYWORD_NEW, /* NEW keyword */ 46 | UP_KEYWORD_UNRECOG /* All other strings */ 47 | }; 48 | 49 | enum UP_SUBJ_RESULT{ 50 | UP_SUBJ_INIT = 0, /* only to initialize in UP_subject_process function */ 51 | UP_SUBJ_HELP_REQ, /* Tells that help is requested in subject line */ 52 | UP_SUBJ_NEW_ENFORCED, /* Tells that NEW keyword is specified in subject line */ 53 | UP_SUBJ_UNRECOG, /* Tells that some unrecognised words found in subj line, 54 | (as well as recognised one[s]) */ 55 | UP_SUBJ_ALL_UNRECOG, /* Tells that all words were unrecognised ones (or subject 56 | line was empty or non-existent */ 57 | UP_SUBJ_INVALID_COMB /* Tells that an invalid combination of keywords is 58 | found */ 59 | }; 60 | 61 | #ifdef __cplusplus 62 | extern "C" { 63 | #endif 64 | 65 | 66 | typedef struct _up_subject_struct{ 67 | int result; /* result of the subject processing */ 68 | char * word_list; /* this is the list of keywords that aren't recognised */ 69 | } up_subject_struct; 70 | 71 | 72 | 73 | 74 | up_subject_struct UP_subject_process(const char *subject_line); 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif