Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

helpfile.h

00001 /* $Id: helpfile.h,v 1.1.1.1 2003/07/04 02:53:56 Mysid Exp $ */
00002 
00003 /* Copyright (c) 1998 Michael Graff <explorer@flame.org>
00004  * All rights reserved. 
00005  *
00006  * Redistribution and use in source and binary forms, with or without 
00007  * modification, are permitted provided that the following conditions 
00008  * are met: 
00009  * 1. Redistributions of source code must retain the above copyright 
00010  *    notice, this list of conditions and the following disclaimer. 
00011  * 2. Redistributions in binary form must reproduce the above copyright 
00012  *    notice, this list of conditions and the following disclaimer in the 
00013  *    documentation and/or other materials provided with the distribution. 
00014  * 3. Neither the name of the authors nor the names of its contributors 
00015  *    may be used to endorse or promote products derived from this software 
00016  *    without specific prior written permission. 
00017  *
00018  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 
00019  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
00020  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
00021  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 
00022  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
00023  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
00024  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
00025  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00026  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
00027  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
00028  * SUCH DAMAGE.
00029  */
00030 
00031 #include "config.h"
00032 
00037 #define HELPFILE_MAX_LINES 128
00038 
00039 #define HELPFILE_CMD_PRINTF    1  // print the line
00040 #define HELPFILE_CMD_EXIT      2  // terminate printing
00041 
00042 #define HELPFILE_FLAG_OPER      0x00000001
00043 #define HELPFILE_FLAG_SERVOP        0x00000002
00044 #define HELPFILE_FLAG_SRA       0x00000004
00045 
00046 class helpline_t {
00047 private:
00048     u_int32_t   flags;
00049     u_int32_t   mask;
00050     u_int32_t   cmd;
00051     char       *text;
00052     helpline_t *next;
00053 
00054 public:
00055     helpline_t(void);
00056     helpline_t(u_int32_t, u_int32_t, u_int32_t, char *);
00057 
00058     ~helpline_t();
00059 
00060     void delchain(void);
00061 
00062     inline helpline_t *get_next(void) { return next; }
00063     inline void set_next(helpline_t *x_next) { next = x_next; }
00064 
00065     inline u_int32_t get_flags(void) { return flags; }
00066     inline void set_flags(u_int32_t x_flags) { flags = x_flags; }
00067 
00068     inline u_int32_t get_mask(void) { return mask; }
00069     inline void set_mask(u_int32_t x_mask) { mask = x_mask; }
00070 
00071     inline u_int32_t get_cmd(void) { return cmd; }
00072     inline void set_cmd(u_int32_t x_cmd) { cmd = x_cmd; }
00073 
00074     inline char *get_text(void) { return text; }
00075     inline void set_text(char *x_text) { text = x_text; }
00076 };
00077 
00078 class helpfile_t {
00079 private:
00080     char        *fname;
00081     helpline_t  *first;
00082     helpline_t  *last;
00083 
00084 public:
00085     helpfile_t(void);
00086     ~helpfile_t();
00087 
00088     void readfile(char *);
00089     void addline(u_int32_t, u_int32_t, u_int32_t, char *);
00090     void display(u_int32_t);
00091 };
00092 
00093 typedef struct {
00094     char      *name;
00095     u_int32_t  flags;
00096     u_int32_t  mask;
00097 } flagmap_t;
00098 
00099 void helpfile_parse_if(u_int32_t *, u_int32_t *, char *);

Generated at Sat Oct 25 20:56:07 2003 for Services using Doxygen.
Services Copyr. 1996-2001 Chip Norkus, Max Byrd, Greg Poma, Michael Graff, James Hess, Dafydd James. All rights reserved See LICENSE for licensing information.