PennMUSH Community

root/1.8.3/trunk/hdrs/mushtype.h

Revision 1117, 5.6 kB (checked in by shawnw, 1 year ago)

Merge with devel

Line 
1 #ifndef MUSH_TYPES_H
2 #define MUSH_TYPES_H
3 #include "copyrite.h"
4 #ifdef HAS_OPENSSL
5 #include <openssl/ssl.h>
6 #endif
7 #ifdef HAVE_STDINT_H
8 #include <stdint.h>
9 #endif
10
11 /** Math function floating-point number type */
12 typedef double NVAL;
13
14 /* Math function integral type */
15 typedef int32_t IVAL;
16
17 /** Math function unsigned integral type */
18 typedef uint32_t UIVAL;
19
20 #define SIZEOF_IVAL 4
21
22 /** Dbref type */
23 typedef int dbref;
24
25 /** The type that stores the warning bitmask */
26 typedef uint32_t warn_type;
27
28 /** Attribute/lock flag types */
29 typedef uint32_t privbits;
30
31 /* special dbref's */
32 #define NOTHING (-1)            /* null dbref */
33 #define AMBIGUOUS (-2)          /* multiple possibilities, for matchers */
34 #define HOME (-3)               /* virtual room, represents mover's home */
35 #define ANY_OWNER (-2)          /* For lstats and @stat */
36
37
38 #define INTERACT_SEE 0x1
39 #define INTERACT_HEAR 0x2
40 #define INTERACT_MATCH 0x4
41 #define INTERACT_PRESENCE 0x8
42
43 typedef unsigned char *object_flag_type;
44
45 /* Boolexps and locks */
46 typedef const char *lock_type;
47 typedef struct lock_list lock_list;
48
49 typedef struct pe_info PE_Info;
50 typedef struct debug_info Debug_Info;
51 /** process_expression() info
52  * This type is used by process_expression().  In all but parse.c,
53  * this should be left as an incompletely-specified type, making it
54  * impossible to declare anything but pointers to it.
55  *
56  * Unfortunately, we need to know what it is in funlist.c, too,
57  * to prevent denial-of-service attacks.  ARGH!  Don't look at
58  * this struct unless you _really_ want to get your hands dirty.
59  */
60 struct pe_info {
61   int fun_invocations;          /**< Invocation count */
62   int fun_depth;                /**< Recursion count */
63   int nest_depth;               /**< Depth of function nesting, for DEBUG */
64   int call_depth;               /**< Function call counter */
65   Debug_Info *debug_strings;    /**< DEBUG infromation */
66   int arg_count;                /**< Number of arguments passed to function */
67 };
68
69
70 /* new attribute foo */
71 typedef struct attr ATTR;
72 typedef ATTR ALIST;
73
74 /** A text block
75  */
76 struct text_block {
77   int nchars;                   /**< Number of characters in the block */
78   struct text_block *nxt;       /**< Pointer to next block in queue */
79   unsigned char *start;         /**< Start of text */
80   unsigned char *buf;           /**< Current position in text */
81 };
82 /** A queue of text blocks.
83  */
84 struct text_queue {
85   struct text_block *head;      /**< Pointer to the head of the queue */
86   struct text_block **tail;     /**< Pointer to pointer to tail of the queue */
87 };
88
89 /* Descriptor foo */
90 /** Using Pueblo, Smial, Mushclient, Simplemu, or some other
91  *  *  pueblo-style HTML aware client */
92 #define CONN_HTML 0x1
93 /** Using a client that understands telnet options */
94 #define CONN_TELNET 0x2
95 /** Send a telnet option to test client */
96 #define CONN_TELNET_QUERY 0x4
97 /** Connection that should be close on load from reboot.db */
98 #define CONN_CLOSE_READY 0x8
99 /** Validated connection from an SSL concentrator */
100 #define CONN_SSL_CONCENTRATOR 0x10
101 /** Player would like to receive newlines after prompts, because
102  *  * their client mucks up output after a GOAHEAD */
103 #define CONN_PROMPT_NEWLINES 0x20
104 /** Default connection, nothing special */
105 #define CONN_DEFAULT (CONN_PROMPT_NEWLINES)
106
107 #define DOING_LEN 40
108 /** Pueblo checksum length.
109  * Pueblo uses md5 now, but if they switch to sha1, this will still
110  * be safe.
111  */
112 #define PUEBLO_CHECKSUM_LEN 40
113 typedef struct descriptor_data DESC;
114 /** A player descriptor's data.
115  * This structure associates a connection's socket (file descriptor)
116  * with a lot of other relevant information.
117  */
118 struct descriptor_data {
119   int descriptor;       /**< Connection socket (fd) */
120   int connected;        /**< Connection status */
121   char addr[101];       /**< Hostname of connection source */
122   char ip[101];         /**< IP address of connection source */
123   dbref player;         /**< Dbref of player associated with connection */
124   unsigned char *output_prefix; /**< Text to show before output */
125   unsigned char *output_suffix; /**< Text to show after output */
126   int output_size;              /**< Size of output left to send */
127   struct text_queue output;     /**< Output text queue */
128   struct text_queue input;      /**< Input text queue */
129   unsigned char *raw_input;     /**< Pointer to start of next raw input */
130   unsigned char *raw_input_at;  /**< Pointer to position in raw input */
131   time_t connected_at;    /**< Time of connection */
132   time_t last_time;       /**< Time of last activity */
133   int quota;            /**< Quota of commands allowed */
134   int cmds;             /**< Number of commands sent */
135   int hide;             /**< Hide status */
136   char doing[DOING_LEN];        /**< Player's doing string */
137   struct descriptor_data *next; /**< Next descriptor in linked list */
138   struct descriptor_data *prev; /**< Previous descriptor in linked list */
139   int conn_flags;       /**< Flags of connection (telnet status, etc.) */
140   unsigned long input_chars;    /**< Characters received */
141   unsigned long output_chars;   /**< Characters sent */
142   int width;                    /**< Screen width */
143   int height;                   /**< Screen height */
144   char *ttype;                  /**< Terminal type */
145 #ifdef HAS_OPENSSL
146   SSL *ssl;                     /**< SSL object */
147   int ssl_state;                /**< Keep track of state of SSL object */
148 #endif
149   char checksum[PUEBLO_CHECKSUM_LEN + 1];       /**< Pueblo checksum */
150 };
151
152 /* max length of command argument to process_command */
153 #define MAX_COMMAND_LEN 4096
154 #define BUFFER_LEN ((MAX_COMMAND_LEN)*2)
155 #define MAX_ARG 63
156
157 /* Channel stuff */
158 typedef struct chanuser CHANUSER;
159 typedef struct chanlist CHANLIST;
160 typedef struct channel CHAN;
161
162 #endif
163
Note: See TracBrowser for help on using the browser.