boris.c File Reference

A plugin oriented MUD. More...

#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <math.h>
#include <signal.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <unistd.h>
#include "boris.h"
#include "list.h"
#include "plugin.h"
#include <dlfcn.h>

Include dependency graph for boris.c:

Go to the source code of this file.

Data Structures

struct  acs_info
 undocumented - please add documentation. More...
struct  bitmap
 a large bitarray that can be allocated to any size. More...
struct  buffer
 undocumented - please add documentation. More...
struct  command_short_table
 table of short commands, they must start with a punctuation. More...
struct  command_table
struct  config
 undocumented - please add documentation. More...
struct  config_watcher
 undocumented - please add documentation. More...
struct  dll_handle_t
 handle for an open DLL used by dll_open() and dll_close(). More...
struct  form
 undocumented - please add documentation. More...
struct  form_state
 undocumented - please add documentation. More...
struct  formitem
 undocumented - please add documentation. More...
struct  freelist_entry
 undocumented - please add documentation. More...
struct  freelist_extent
 undocumented - please add documentation. More...
struct  heapqueue_elm
 undocumented - please add documentation. More...
struct  menuinfo
 undocumented - please add documentation. More...
struct  menuitem
 undocumented - please add documentation. More...
struct  mud_config
 undocumented - please add documentation. More...
struct  plugin
struct  server
 undocumented - please add documentation. More...
struct  sha1_ctx
 data structure holding the state of the hash processing. More...
struct  socketio_handle
 undocumented - please add documentation. More...
struct  telnetclient
 undocumented - please add documentation. More...
union  telnetclient::telnetclient::state_data
 undocumented - please add documentation. More...
struct  telnetclient::telnetclient::state_data::telnetclient::state_data::login_state
 undocumented - please add documentation. More...
struct  telnetclient::telnetclient::state_data::telnetclient::state_data::menu_state
 undocumented - please add documentation. More...
struct  telnetclient::telnetclient::terminal
 undocumented - please add documentation. More...
struct  user
 undocumented - please add documentation. More...
struct  userdb_entry
struct  util_strfile
 undocumented - please add documentation. More...
struct  webserver
 handle for a webserver client. More...

Defines

#define _make_name(x, y)   _make_name2(x,y)
 _make_name is used by var.
#define _make_name2(x, y)   x##y
 _make_name2 is used by VAR and _make_name.
#define _make_string(x)   _make_string2(x)
 _make_string is used to turn an value into a string.
#define _make_string2(x)   #x
 _make_string2 is used by _make_string
#define ABORT   '\356'
 undocumented - please add documentation.
#define AO   '\365'
 undocumented - please add documentation.
#define AYT   '\366'
 undocumented - please add documentation.
#define BITCLR(x, bit)   (x)[(bit)/((CHAR_BIT*sizeof *(x)))]&=~(1<<((bit)&((CHAR_BIT*sizeof *(x))-1)))
 clear bit position 'bit' in bitfield x
#define BITFIELD(bits, type)   (((bits)+(CHAR_BIT*sizeof(type))-1)/(CHAR_BIT*sizeof(type)))
 return in type sized elements to create a bitfield of 'bits' bits.
#define BITINV(x, bit)   (x)[(bit)/((CHAR_BIT*sizeof *(x)))]^=1<<((bit)&((CHAR_BIT*sizeof *(x))-1))
 toggle bit position 'bit' in bitfield x.
#define BITMAP_BITSIZE   (sizeof(unsigned)*CHAR_BIT)
 size in bits of a group of bits for struct bitmap.
#define BITRANGE(x, bit)   ((bit)<(sizeof(x)*CHAR_BIT))
 checks that bit is in range for bitfield x.
#define BITSET(x, bit)   (x)[(bit)/((CHAR_BIT*sizeof *(x)))]|=1<<((bit)&((CHAR_BIT*sizeof *(x))-1))
 set bit position 'bit' in bitfield x.
#define BITTEST(x, bit)   ((x)[(bit)/((CHAR_BIT*sizeof *(x)))]&(1<<((bit)&((CHAR_BIT*sizeof *(x))-1))))
 return a large non-zero number if the bit is set, zero if clear.
#define BORIS_VERSION_MAJ   0
#define BORIS_VERSION_MIN   5
#define BORIS_VERSION_PAT   0
#define BORIS_VERSION_STR
#define BREAK   '\363'
 undocumented - please add documentation.
#define DEBUG(msg,...)   fprintf(stderr, "DEBUG:%s():%d:" msg, __func__, __LINE__, ## __VA_ARGS__);
 DEBUG() prints a formatted message to stderr if NDEBUG is not defined.
#define DEBUG_MSG(msg)   fprintf(stderr, "ERROR:%s():%d:" msg "\n", __func__, __LINE__);
 DEBUG_MSG prints a string and newline to stderr if NDEBUG is not defined.
#define DIE()   do { ERROR_MSG("abort!"); abort(); } while(0)
 DIE - print the function and line number then abort.
#define DM   '\362'
 undocumented - please add documentation.
#define DO   '\375'
 undocumented - please add documentation.
#define DONT   '\376'
 undocumented - please add documentation.
#define EC   '\367'
 undocumented - please add documentation.
#define EL   '\370'
 undocumented - please add documentation.
#define EOR   '\357'
 undocumented - please add documentation.
#define ERROR_FMT(msg,...)   fprintf(stderr, "ERROR:%s():%d:" msg, __func__, __LINE__, __VA_ARGS__);
 ERROR_FMT() prints a formatted message to stderr.
#define ERROR_MSG(msg)   fprintf(stderr, "ERROR:%s():%d:" msg "\n", __func__, __LINE__);
 ERROR_MSG prints a string and newline to stderr.
#define EXPORT
 tag a function as being an exported symbol.
#define FAILON(e, reason, label)   do { if(e) { fprintf(stderr, "FAILED:%s:%s\n", reason, strerror(errno)); goto label; } } while(0)
 tests an expression, if failed prints an error message based on errno and jumps to a label.
#define FORM_FLAG_HIDDEN   1
#define FORM_FLAG_INVISIBLE   2
#define FOURCC(a, b, c, d)
 make four ASCII characters into a 32-bit integer.
#define GA   '\371'
 undocumented - please add documentation.
#define GCC_ONLY(x)
 this version defined if not using GCC.
#define HEAPQUEUE_LEFT(i)   (2*(i)+1)
 undocumented - please add documentation.
#define HEAPQUEUE_PARENT(i)   (((i)-1)/2)
 undocumented - please add documentation.
#define HEAPQUEUE_RIGHT(i)   (2*(i)+2)
 undocumented - please add documentation.
#define HEXDUMP(data, len,...)   do { fprintf(stderr, __VA_ARGS__); util_hexdump(stderr, data, len); } while(0)
 HEXDUMP() outputs a message and block of hexdump data to stderr if NDEBUG is not defined.
#define HEXDUMP_TRACE(data, len,...)   HEXDUMP(data, len, __VA_ARGS__)
 HEXDUMP_TRACE() does a hexdump to stderr if NTRACE is not defined.
#define IAC   '\377'
 undocumented - please add documentation.
#define INVALID_SOCKET   (-1)
 undocumented - please add documentation.
#define IP   '\364'
 undocumented - please add documentation.
#define JUNKINIT(ptr, len)   memset((ptr), 0xBB, (len));
 initialize with junk - used to find unitialized values.
#define LM_FORWARDMASK   2
 undocumented - please add documentation.
#define LM_MODE   1
 undocumented - please add documentation.
#define LM_SLC   3
 undocumented - please add documentation.
#define MKDIR(d)   mkdir(d, 0777)
 macro used to wrap mkdir() function from UNIX and Windows
#define MODE_ACK   4
 undocumented - please add documentation.
#define MODE_EDIT   1
 undocumented - please add documentation.
#define MODE_LIT_ECHO   16
 undocumented - please add documentation.
#define MODE_MASK   31
 undocumented - please add documentation.
#define MODE_SOFT_TAB   8
 undocumented - please add documentation.
#define MODE_TRAPSIG   2
 undocumented - please add documentation.
#define NOP   '\361'
 undocumented - please add documentation.
#define PERROR(msg)   fprintf(stderr, "ERROR:%s():%d:%s:%s\n", __func__, __LINE__, msg, strerror(errno));
 logs a message based on errno
#define PLUGIN_NAME_MAX   64
#define RD_BE16(src, offset)   ((((src)[offset]&255u)<<8)|((src)[(offset)+1]&255u))
 ReaD Big-Endian 16-bit value.
#define RD_BE32(src, offset)
 ReaD Big-Endian 32-bit value.
#define RD_BE64(src, offset)
 ReaD Big-Endian 64-bit value.
#define REFCOUNT_GET(obj)   do { (obj)->REFCOUNT_NAME++; } while(0)
 undocumented - please add documentation.
#define REFCOUNT_INIT(obj)   ((obj)->REFCOUNT_NAME=0)
 undocumented - please add documentation.
#define REFCOUNT_NAME   _referencecount
 undocumented - please add documentation.
#define REFCOUNT_PUT(obj, free_action)
 undocumented - please add documentation.
#define REFCOUNT_TAKE(obj)   ((obj)->REFCOUNT_NAME++)
 undocumented - please add documentation.
#define REFCOUNT_TYPE   int
 undocumented - please add documentation.
#define ROL(f, v, b)   ((((v)<<(b))|((v)>>((f)-(b))))&(0xfffffffful>>(32-(f))))
 rotate a value in an f-bit field left by b bits.
#define ROL32(v, b)   ROL(32, v, b)
#define SB   '\372'
 undocumented - please add documentation.
#define SE   '\360'
 undocumented - please add documentation.
#define SHA1_DIGEST_LENGTH   20
 size of a SHA-1 digest in bytes.
#define SHA1_K0   0x5a827999
 SHA-1 Constants.
#define SHA1_K1   0x6ed9eba1
#define SHA1_K2   0x8f1bbcdc
#define SHA1_K3   0xca62c1d6
#define SHA1_LBLOCK   16
 number of 32-bit values in a 512-bit block.
#define SHA1CRYPT_BITS   128
 Number of bits used by SHA-1.
#define SHA1CRYPT_GENSALT_LEN   6
 undocumented - please add documentation.
#define SHA1CRYPT_GENSALT_MAX   16
 undocumented - please add documentation.
#define SHA1PASSWD_MAGIC   "{SSHA}"
 prefix for salted SHA1 password hash.
#define SHA1PASSWD_MAGIC_LEN   6
 length of SHA1PASSWD_MAGIC.
#define SHA1PASSWD_MAX   (SHA1PASSWD_MAGIC_LEN+((SHA1_DIGEST_LENGTH+SHA1CRYPT_GENSALT_MAX+3)/4*4)*4/3+1)
 maximum length of crypted password including null termination.
#define SHVAR_ESCAPE   '$'
 escape character used.
#define SHVAR_ID_MAX   128
 maximum number of characters in a $().
#define SOCKET_ERROR   (-1)
 undocumented - please add documentation.
#define SOCKETIO_FAILON(e, reason, fail_label)   do { if(e) { fprintf(stderr, "ERROR:%s:%s\n", reason, socketio_strerror()); goto fail_label; } } while(0)
 undocumented - please add documentation.
#define SOCKETIO_LISTEN_QUEUE   10
 number of connections that can be queues waiting for accept().
#define SOEXT   ".so"
#define SUSP   '\355'
 undocumented - please add documentation.
#define SYNCH   '\362'
 undocumented - please add documentation.
#define TELNETCLIENT_INPUT_BUFFER_SZ   256
 undocumented - please add documentation.
#define TELNETCLIENT_OUTPUT_BUFFER_SZ   4096
 undocumented - please add documentation.
#define TELOPT_ECHO   1
 undocumented - please add documentation.
#define TELOPT_LINEMODE   34
 undocumented - please add documentation.
#define TELOPT_NAWS   31
 undocumented - please add documentation.
#define TELOPT_SGA   3
 undocumented - please add documentation.
#define TELOPT_TTYPE   24
 undocumented - please add documentation.
#define TELQUAL_INFO   2
 undocumented - please add documentation.
#define TELQUAL_IS   0
 undocumented - please add documentation.
#define TELQUAL_SEND   1
 undocumented - please add documentation.
#define TODO(msg)   fprintf(stderr, "TODO:%s():%d:" msg "\n", __func__, __LINE__);
 TODO prints a string and newline to stderr.
#define TRACE(f,...)   fprintf(stderr, "TRACE:%s():%u:" f, __func__, __LINE__, __VA_ARGS__)
 TRACE() prints a message to stderr if NTRACE is not defined.
#define TRACE_ENTER()   TRACE("%u:ENTER\n", __LINE__);
 trace logs entry to a function if NTRACE is not defined.
#define TRACE_EXIT()   TRACE("%u:EXIT\n", __LINE__);
 trace logs exit of a function if NTRACE is not defined.
#define TRACE_MSG(m)   TRACE("%s\n", m);
 TRACE_MSG() prints a message and newline to stderr if NTRACE is not defined.
#define UNUSED   GCC_ONLY(__attribute__((unused)))
 macro to mark function parameters as unused, used to supress warnings.
#define USE_BSD_SOCKETS
 detected system with BSD compatible sockets.
#define USER_FLAGS_NEWUSER   mud_config.newuser_flags
 default flags for new users.
#define USER_LEVEL_NEWUSER   mud_config.newuser_level
 user:configuration
#define UTIL_FNM_CASEFOLD   16
 util_fnmatch accepts this as a paramter to perform case insensitive matches.
#define UTIL_FNM_NOMATCH   1
 util_fnmatch returns this value when a match was not found.
#define VAR(x)   _make_name(x,__LINE__)
 VAR() is used for making temp variables in macros.
#define VERBOSE(...)   fprintf(stderr, __VA_ARGS__)
 undocumented - please add documentation.
#define WILL   '\373'
 undocumented - please add documentation.
#define WONT   '\374'
 undocumented - please add documentation.
#define WR_BE16(dest, offset, value)
 WRite Big-Endian 16-bit value.
#define WR_BE32(dest, offset, value)
 WRite Big-Endian 32-bit value.
#define WR_BE64(dest, offset, value)
 WRite Big-Endian 64-bit value.
#define xEOF   '\354'
 undocumented - please add documentation.

Typedefs

typedef int(* dll_func_t )()
typedef void * dll_symbol_t
typedef int SOCKET
 define SOCKET on POSIX systems because Winsock2 uses this typedef too, but it is good to remember that ws2's sockets are unsigned int handles while POSIX/BSD systems use a signed int, with -1 as flag value for an unused or freed socket.

Functions

static int acs_check (struct acs_info *ai, const char *acsstring)
 undocumented - please add documentation.
static void acs_init (struct acs_info *ai, unsigned level, unsigned flags)
 undocumented - please add documentation.
void acs_test (void)
 undocumented - please add documentation.
static int acs_testflag (struct acs_info *ai, unsigned flag)
 undocumented - please add documentation.
int attr_add (struct attr_list *al, const char *name, const char *value)
 add an entry to the end, preserves the order.
struct attr_entryattr_find (struct attr_list *al, const char *name)
 find an attr by name.
void attr_list_free (struct attr_list *al)
 free every element on the list.
static void b_log_dummy (int priority UNUSED, const char *domain UNUSED, const char *fmt,...)
 a default log function to use if none is defined.
EXPORT int base64_decode (size_t in_len, const char *in, size_t out_len, unsigned char *out)
EXPORT int base64_encode (size_t in_len, const unsigned char *in, size_t out_len, char *out)
 base64_encodes as .
EXPORT void bitmap_clear (struct bitmap *bitmap, unsigned ofs, unsigned len)
 set a range of bits to 0.
EXPORT void bitmap_free (struct bitmap *bitmap)
 free a bitmap structure.
EXPORT int bitmap_get (struct bitmap *bitmap, unsigned ofs)
 gets a single bit.
EXPORT void bitmap_init (struct bitmap *bitmap)
 initialize an bitmap structure to be empty.
EXPORT unsigned bitmap_length (struct bitmap *bitmap)
 Get the length (in bytes) of the bitmap table.
EXPORT void bitmap_loadmem (struct bitmap *bitmap, unsigned char *d, size_t len)
 loads a chunk of memory into the bitmap structure.
EXPORT int bitmap_next_clear (struct bitmap *bitmap, unsigned ofs)
 scan a bitmap structure for the next clear bit.
EXPORT int bitmap_next_set (struct bitmap *bitmap, unsigned ofs)
 scan a bitmap structure for the next set bit.
EXPORT int bitmap_resize (struct bitmap *bitmap, size_t newbits)
 resize (grow or shrink) a struct bitmap.
EXPORT void bitmap_set (struct bitmap *bitmap, unsigned ofs, unsigned len)
 set a range of bits to 1.
EXPORT void bitmap_test (void)
 unit tests for struct bitmap data structure.
EXPORT unsigned buffer_consume (struct buffer *b, size_t len)
EXPORT const char * buffer_data (struct buffer *b, size_t *len)
 undocumented - please add documentation.
EXPORT void buffer_emit (struct buffer *b, size_t len)
 commits data to buffer.
static char * buffer_findnl (char *d, size_t *len, size_t(*iac_process)(const char *data, size_t len, void *p), void *p)
 callback returns the number of items consumed.
EXPORT void buffer_free (struct buffer *b)
 free the buffer.
EXPORT const char * buffer_getline (struct buffer *b, size_t *consumed_len, size_t(*iac_process)(const char *data, size_t len, void *p), void *p)
 undocumented - please add documentation.
EXPORT void buffer_init (struct buffer *b, size_t max)
 undocumented - please add documentation.
static int buffer_ll_expandnl (struct buffer *b, size_t len)
 expand newlines into CR/LF startin at used.
EXPORT char * buffer_load (struct buffer *b, size_t *len)
 used for adding more data to the buffer.
static int buffer_printf (struct buffer *b, const char *fmt,...)
 printfs data in a client's output buffer.
static int buffer_puts (struct buffer *b, const char *str)
 puts data in a client's output buffer.
EXPORT int buffer_vprintf (struct buffer *b, const char *fmt, va_list ap)
 printfs and expands newline to CR/LF.
EXPORT int buffer_write (struct buffer *b, const char *str, size_t len)
 writes data and exapands newline to CR/LF.
EXPORT int buffer_write_noexpand (struct buffer *b, const void *data, size_t len)
 special write that does not expand its input.
static int command_do_character (struct telnetclient *cl, struct user *u, const char *cmd UNUSED, const char *arg)
static int command_do_chsay (struct telnetclient *cl, struct user *u, const char *cmd UNUSED, const char *arg)
 undocumented - please add documentation.
static int command_do_emote (struct telnetclient *cl, struct user *u, const char *cmd UNUSED, const char *arg)
 undocumented - please add documentation.
static int command_do_pose (struct telnetclient *cl, struct user *u, const char *cmd UNUSED, const char *arg)
 undocumented - please add documentation.
static int command_do_quit (struct telnetclient *cl, struct user *u UNUSED, const char *cmd UNUSED, const char *arg UNUSED)
 undocumented - please add documentation.
static int command_do_roomget (struct telnetclient *cl, struct user *u, const char *cmd UNUSED, const char *arg)
 undocumented - please add documentation.
static int command_do_say (struct telnetclient *cl, struct user *u, const char *cmd UNUSED, const char *arg)
 undocumented - please add documentation.
static int command_do_yell (struct telnetclient *cl, struct user *u, const char *cmd UNUSED, const char *arg)
 undocumented - please add documentation.
static int command_execute (struct telnetclient *cl, struct user *u, const char *line)
 executes a command for user u.
static void command_lineinput (struct telnetclient *cl, const char *line)
 undocumented - please add documentation.
static int command_not_implemented (struct telnetclient *cl, struct user *u UNUSED, const char *cmd UNUSED, const char *arg UNUSED)
 undocumented - please add documentation.
static int command_run (struct telnetclient *cl, struct user *u, const char *cmd, const char *arg)
 use cmd to run a command from the command_table array.
EXPORT void command_start (void *p, long unused2 UNUSED, void *unused3 UNUSED)
 undocumented - please add documentation.
static void command_start_lineinput (struct telnetclient *cl)
 undocumented - please add documentation.
EXPORT void config_free (struct config *cfg)
 undocumented - please add documentation.
EXPORT int config_load (const char *filename, struct config *cfg)
 undocumented - please add documentation.
EXPORT void config_setup (struct config *cfg)
 undocumented - please add documentation.
static void config_test (void)
 undocumented - please add documentation.
static int config_test_show (struct config *cfg UNUSED, void *extra UNUSED, const char *id, const char *value)
 undocumented - please add documentation.
EXPORT void config_watch (struct config *cfg, const char *mask, int(*func)(struct config *cfg, void *extra, const char *id, const char *value), void *extra)
 adds a watcher with a shell style mask.
EXPORT void dll_close (dll_handle_t h)
 closes an open DLL file handle.
EXPORT int dll_open (dll_handle_t *h, const char *filename)
 opens a file and updates the handle at h.
static void dll_show_error (const char *reason)
 internal function for reporting errors on last operation with a DLL.
EXPORT dll_symbol_t dll_symbol (dll_handle_t h, const char *name)
 get a function's address from a DLL.
static int do_config_msg (struct config *cfg UNUSED, void *extra UNUSED, const char *id, const char *value)
 undocumented - please add documentation.
static int do_config_msgfile (struct config *cfg UNUSED, void *extra UNUSED, const char *id, const char *value)
 undocumented - please add documentation.
static int do_config_port (struct config *cfg UNUSED, void *extra UNUSED, const char *id, const char *value)
 handles the 'server.port' property.
static int do_config_prompt (struct config *cfg UNUSED, void *extra UNUSED, const char *id, const char *value)
 undocumented - please add documentation.
static int do_config_string (struct config *cfg UNUSED, void *extra, const char *id UNUSED, const char *value)
 undocumented - please add documentation.
static int do_config_uint (struct config *cfg UNUSED, void *extra, const char *id UNUSED, const char *value)
 undocumented - please add documentation.
static int dummy_fdb_domain_init (const char *domain UNUSED)
static struct fdb_iteratordummy_fdb_iterator_begin (const char *domain UNUSED)
static void dummy_fdb_iterator_end (struct fdb_iterator *it UNUSED)
static const char * dummy_fdb_iterator_next (struct fdb_iterator *it UNUSED)
static struct fdb_read_handledummy_fdb_read_begin (const char *domain UNUSED, const char *id UNUSED)
static struct fdb_read_handledummy_fdb_read_begin_uint (const char *domain UNUSED, unsigned id UNUSED)
static int dummy_fdb_read_end (struct fdb_read_handle *h UNUSED)
static int dummy_fdb_read_next (struct fdb_read_handle *h UNUSED, const char **name UNUSED, const char **value UNUSED)
static void dummy_fdb_write_abort (struct fdb_write_handle *h UNUSED)
static struct fdb_write_handledummy_fdb_write_begin (const char *domain UNUSED, const char *id UNUSED)
static struct fdb_write_handledummy_fdb_write_begin_uint (const char *domain UNUSED, unsigned id UNUSED)
static int dummy_fdb_write_end (struct fdb_write_handle *h UNUSED)
static int dummy_fdb_write_format (struct fdb_write_handle *h UNUSED, const char *name UNUSED, const char *value_fmt UNUSED,...)
static int dummy_fdb_write_pair (struct fdb_write_handle *h UNUSED, const char *name UNUSED, const char *value_str UNUSED)
EXPORT void eventlog (const char *type, const char *fmt,...)
 undocumented - please add documentation.
EXPORT void eventlog_channel_join (const char *remote, const char *channel_name, const char *username)
 undocumented - please add documentation.
EXPORT void eventlog_channel_new (const char *channel_name)
 undocumented - please add documentation.
EXPORT void eventlog_channel_part (const char *remote, const char *channel_name, const char *username)
 undocumented - please add documentation.
EXPORT void eventlog_channel_remove (const char *channel_name)
 undocumented - please add documentation.
EXPORT void eventlog_commandinput (const char *remote, const char *username, const char *line)
 log commands that a user enters.
EXPORT void eventlog_connect (const char *peer_str)
 report that a connection has occured.
EXPORT int eventlog_init (void)
 initialize the eventlog component.
EXPORT void eventlog_login_failattempt (const char *username, const char *peer_str)
 undocumented - please add documentation.
EXPORT void eventlog_server_shutdown (void)
 undocumented - please add documentation.
EXPORT void eventlog_server_startup (void)
 undocumented - please add documentation.
EXPORT void eventlog_shutdown (void)
 undocumented - please add documentation.
EXPORT void eventlog_signoff (const char *username, const char *peer_str)
 undocumented - please add documentation.
EXPORT void eventlog_signon (const char *username, const char *peer_str)
 undocumented - please add documentation.
EXPORT void eventlog_toomany (void)
 undocumented - please add documentation.
EXPORT void eventlog_webserver_get (const char *remote, const char *uri)
 logs an HTTP GET action.
EXPORT void form_additem (struct form *f, unsigned flags, const char *name, const char *prompt, const char *description, int(*form_check)(struct telnetclient *cl, const char *str))
 undocumented - please add documentation.
static void form_createaccount_close (struct telnetclient *cl, struct form_state *fs)
 undocumented - please add documentation.
static int form_createaccount_password2_check (struct telnetclient *cl, const char *str)
 verify that the second password entry matches the first
static int form_createaccount_password_check (struct telnetclient *cl, const char *str)
static void form_createaccount_start (void *p, long unused2 UNUSED, void *unused3 UNUSED)
 undocumented - please add documentation.
static int form_createaccount_username_check (struct telnetclient *cl, const char *str)
 undocumented - please add documentation.
EXPORT void form_free (struct form *f)
 undocumented - please add documentation.
static struct formitemform_getitem (struct form *f, const char *name)
 undocumented - please add documentation.
static const char * form_getvalue (const struct form *f, unsigned nr_value, char **value, const char *name)
 look up the user value from a form.
EXPORT void form_init (struct form *f, const char *title, void(*form_close)(struct telnetclient *cl, struct form_state *fs))
 undocumented - please add documentation.
static void form_lineinput (struct telnetclient *cl, const char *line)
 undocumented - please add documentation.
EXPORT struct formform_load (const char *buf, void(*form_close)(struct telnetclient *cl, struct form_state *fs))
 undocumented - please add documentation.
EXPORT struct formform_load_from_file (const char *filename, void(*form_close)(struct telnetclient *cl, struct form_state *fs))
 undocumented - please add documentation.
static void form_menu_lineinput (struct telnetclient *cl, const char *line)
 undocumented - please add documentation.
static void form_menu_show (struct telnetclient *cl, const struct form *f, struct form_state *fs)
 undocumented - please add documentation.
EXPORT int form_module_init (void)
 undocumented - please add documentation.
EXPORT void form_module_shutdown (void)
 undocumented - please add documentation.
EXPORT void form_setmessage (struct form *f, const char *message)
 define a message to be displayed on start.
static void form_start (void *p, long unused2 UNUSED, void *form)
 undocumented - please add documentation.
static void form_state_free (struct telnetclient *cl)
 undocumented - please add documentation.
EXPORT void form_state_init (struct form_state *fs, const struct form *f)
 undocumented - please add documentation.
long freelist_alloc (struct freelist *fl, unsigned count)
 allocate memory from the pool.
static void freelist_dump (struct freelist *fl)
 undocumented - please add documentation.
void freelist_free (struct freelist *fl)
 undocumented - please add documentation.
void freelist_init (struct freelist *fl)
 undocumented - please add documentation.
static void freelist_ll_free (struct freelist_entry *e)
 lowlevel - detach and free an entry.
static int freelist_ll_isbridge (struct freelist_extent *prev_ext, unsigned ofs, unsigned count, struct freelist_extent *next_ext)
 checks two extents and determine if they are immediately adjacent.
static struct freelist_entryfreelist_ll_new (struct freelist_entry **prev, unsigned ofs, unsigned count)
 lowlevel - append an extra to the global list at prev
void freelist_pool (struct freelist *fl, unsigned ofs, unsigned count)
 adds a piece to the freelist pool.
EXPORT void freelist_test (void)
 undocumented - please add documentation.
int freelist_thwack (struct freelist *fl, unsigned ofs, unsigned count)
 allocates a particular range on a freelist.
EXPORT int game_init (void)
 undocumented - please add documentation.
EXPORT int heapqueue_cancel (unsigned i, struct heapqueue_elm *ret)
 removes entry at i.
EXPORT int heapqueue_dequeue (struct heapqueue_elm *ret)
 sift-down operation for dequeueing.
static void heapqueue_dump (void)
 undocumented - please add documentation.
EXPORT void heapqueue_enqueue (struct heapqueue_elm *elm)
 sift-up operation for enqueueing.
static int heapqueue_greaterthan (struct heapqueue_elm *a, struct heapqueue_elm *b)
 min heap is sorted by lowest value at root.
static int heapqueue_isvalid (void)
 checks the heap to see that it is valid.
static int heapqueue_ll_siftdown (unsigned i, struct heapqueue_elm *elm)
static int heapqueue_ll_siftup (unsigned i, struct heapqueue_elm *elm)
EXPORT void heapqueue_test (void)
 undocumented - please add documentation.
 LIST_HEAD (struct plugin_list, struct plugin)
 list of loaded plugin.
static LIST_HEAD (struct socketio_handle_list, struct socketio_handle)
 undocumented - please add documentation.
static LIST_HEAD (struct, struct userdb_entry)
 undocumented - please add documentation.
static void login_password_lineinput (struct telnetclient *cl, const char *line)
 undocumented - please add documentation.
static void login_password_start (void *p, long unused2 UNUSED, void *unused3 UNUSED)
 undocumented - please add documentation.
static void login_username_lineinput (struct telnetclient *cl, const char *line)
 undocumented - please add documentation.
static void login_username_start (void *p, long unused2 UNUSED, void *unused3 UNUSED)
 undocumented - please add documentation.
int main (int argc, char **argv)
 main - where it all starts.
EXPORT void menu_additem (struct menuinfo *mi, int ch, const char *name, void(*func)(void *, long, void *), long extra2, void *extra3)
 undocumented - please add documentation.
EXPORT void menu_create (struct menuinfo *mi, const char *title)
 undocumented - please add documentation.
EXPORT void menu_input (struct telnetclient *cl, const struct menuinfo *mi, const char *line)
 undocumented - please add documentation.
static void menu_lineinput (struct telnetclient *cl, const char *line)
 undocumented - please add documentation.
EXPORT void menu_show (struct telnetclient *cl, const struct menuinfo *mi)
 undocumented - please add documentation.
static void menu_start (void *p, long unused2 UNUSED, void *extra3)
 used as a generic starting point for menus.
static void menu_titledraw (struct telnetclient *cl, const char *title, size_t len)
 draw a little box around the string.
EXPORT void mud_config_init (void)
 intialize default configuration.
EXPORT int mud_config_process (void)
 setup config loging callback functions then reads in a configuration file.
EXPORT void mud_config_shutdown (void)
 free all configuration data.
static void need_parameter (int ch, const char *next_arg)
 check if a flag needs a parameter and exits if next_arg is NULL.
int parse_attr (const char *name, const char *value, struct attr_list *al)
 add to an attribute list.
int parse_str (const char *name UNUSED, const char *value, char **str_p)
 load a string into str_p, free()ing string at str_p first.
int parse_uint (const char *name, const char *value, unsigned *uint_p)
 parse a value string into a uint.
static struct pluginplugin_find (const char *name)
EXPORT int plugin_load (const char *name)
EXPORT int plugin_load_list (const char *list)
 go through a space seperated list and load all the plugins.
static void process_args (int argc, char **argv)
 process all command-line arguments.
static int process_flag (int ch, const char *next_arg)
 called for each command-line flag passed to decode them.
static void server_free (struct socketio_handle *sh, void *p)
 undocumented - please add documentation.
EXPORT void server_read_event (struct socketio_handle *sh, SOCKET fd, void *p)
 undocumented - please add documentation.
void service_attach_channel (const struct plugin_basic_class *cls, const struct plugin_channel_interface *interface)
void service_attach_character (const struct plugin_basic_class *cls, const struct plugin_character_interface *interface)
void service_attach_fdb (const struct plugin_basic_class *cls, const struct plugin_fdb_interface *interface)
 attach an interface to fdb.
void service_attach_log (void(*log)(int priority, const char *domain, const char *fmt,...))
 attach a function pointer to provide log service.
void service_attach_room (const struct plugin_basic_class *cls, const struct plugin_room_interface *interface)
void service_detach_channel (const struct plugin_basic_class *cls)
void service_detach_character (const struct plugin_basic_class *cls)
void service_detach_fdb (const struct plugin_basic_class *cls)
 deattach an interface from fdb, but only if class is the current owner.
int service_detach_log (void(*log)(int priority, const char *domain, const char *fmt,...))
 detach the function pointer providing the log service.
void service_detach_room (const struct plugin_basic_class *cls)
static void sh_quit (int s UNUSED)
 signal handler to cause the main loop to terminated by clearing keep_going_fl.
EXPORT unsigned char * sha1 (const void *data, size_t len, unsigned char *md)
 quick calculation of SHA1 on buffer data.
static void sha1_append_length (struct sha1_ctx *ctx)
 pad SHA-1 with 1s followed by 0s and a 64-bit value of the number of bits.
EXPORT int sha1_final (unsigned char *md, struct sha1_ctx *ctx)
 finish up the hash, and pad in the special SHA-1 way with the length.
EXPORT int sha1_init (struct sha1_ctx *ctx)
 initialize the hash context.
static void sha1_print_digest (const unsigned char *md)
static int sha1_test (void)
static void sha1_transform_chunk (struct sha1_ctx *ctx)
 do this transformation for each chunk, chunk assumed to be loaded into ctx->data[].
EXPORT int sha1_update (struct sha1_ctx *ctx, const void *data, size_t len)
 hash more data to the stream.
EXPORT int sha1crypt_checkpass (const char *crypttext, const char *plaintext)
static int sha1crypt_create_password (char *buf, size_t max, const char *plaintext, size_t salt_len, const unsigned char *salt)
static void sha1crypt_gensalt (size_t salt_len, void *salt)
 generate a salt for the hash.
EXPORT int sha1crypt_makepass (char *buf, size_t max, const char *plaintext)
EXPORT void sha1crypt_test (void)
void show_version (void)
EXPORT int shvar_eval (char *out, size_t len, const char *src, const char *(*match)(const char *key))
 undocumented - please add documentation.
static void signoff (void *p, long unused2 UNUSED, void *unused3 UNUSED)
 undocumented - please add documentation.
EXPORT int socketio_check_count (SOCKET fd)
 You should call this whenever opening a new socket.
EXPORT int socketio_close (SOCKET *fd)
 undocumented - please add documentation.
EXPORT int socketio_dispatch (long msec)
 undocumented - please add documentation.
static void socketio_dump_fdset (fd_set *readfds, fd_set *writefds)
 undocumented - please add documentation.
EXPORT int socketio_eintr (void)
static void socketio_fdset_copy (fd_set *dst, const fd_set *src)
 undocumented - please add documentation.
EXPORT int socketio_getpeername (SOCKET fd, char *name, size_t name_len)
 undocumented - please add documentation.
EXPORT int socketio_init (void)
 undocumented - please add documentation.
EXPORT struct socketio_handlesocketio_listen (int family, int socktype, const char *host, const char *port, void(*newclient)(struct socketio_handle *sh))
 opens and binds a listening socket on a port.
static struct socketio_handlesocketio_listen_bind (struct addrinfo *ai, void(*newclient)(struct socketio_handle *new_sh))
 undocumented - please add documentation.
static void socketio_ll_handle_free (struct socketio_handle *sh)
 undocumented - please add documentation.
static struct socketio_handlesocketio_ll_newhandle (SOCKET fd, const char *name, unsigned type, void(*write_event)(struct socketio_handle *sh, SOCKET fd, void *p), void(*read_event)(struct socketio_handle *sh, SOCKET fd, void *p))
 undocumented - please add documentation.
static int socketio_nonblock (SOCKET fd)
 undocumented - please add documentation.
EXPORT void socketio_readready (SOCKET fd)
 report that an fd is ready for read events, and update the fdmax value.
EXPORT int socketio_recv (SOCKET fd, void *data, size_t len)
 undocumented - please add documentation.
EXPORT int socketio_send (SOCKET fd, const void *data, size_t len)
 undocumented - please add documentation.
EXPORT void socketio_shutdown (void)
 undocumented - please add documentation.
EXPORT int socketio_sockname (struct sockaddr *sa, socklen_t salen, char *name, size_t name_len)
 undocumented - please add documentation.
static void socketio_toomany (SOCKET fd)
 undocumented - please add documentation.
EXPORT int socketio_wouldblock (void)
EXPORT void socketio_writeready (SOCKET fd)
 report that an fd is ready for write events, and update the fdmax value.
static int telnetclient_channel_add (struct telnetclient *cl, struct channel *ch)
static int telnetclient_channel_remove (struct telnetclient *cl, struct channel *ch)
static void telnetclient_channel_send (struct channel_member *cm, struct channel *ch, const char *msg)
static void telnetclient_clear_statedata (struct telnetclient *cl)
 undocumented - please add documentation.
EXPORT void telnetclient_close (struct telnetclient *cl)
 undocumented - please add documentation.
static int telnetclient_echomode (struct telnetclient *cl, int mode)
 undocumented - please add documentation.
static void telnetclient_free (struct socketio_handle *sh, void *p)
 undocumented - please add documentation.
static size_t telnetclient_iac_process (const char *iac, size_t len, void *p)
static void telnetclient_iac_process_sb (const char *iac, size_t len, struct telnetclient *cl)
 for processing IAC SB.
static int telnetclient_isstate (struct telnetclient *cl, void(*line_input)(struct telnetclient *cl, const char *line), const char *prompt)
static int telnetclient_linemode (struct telnetclient *cl, int mode)
 undocumented - please add documentation.
EXPORT void telnetclient_new_event (struct socketio_handle *sh)
 undocumented - please add documentation.
static struct telnetclienttelnetclient_newclient (struct socketio_handle *sh)
 undocumented - please add documentation.
EXPORT int telnetclient_printf (struct telnetclient *cl, const char *fmt,...)
 undocumented - please add documentation.
EXPORT void telnetclient_prompt_refresh (struct telnetclient *cl)
 undocumented - please add documentation.
EXPORT void telnetclient_prompt_refresh_all (void)
 undocumented - please add documentation.
EXPORT int telnetclient_puts (struct telnetclient *cl, const char *str)
 undocumented - please add documentation.
EXPORT void telnetclient_rdev_lineinput (struct socketio_handle *sh, SOCKET fd, void *extra)
 undocumented - please add documentation.
static int telnetclient_recv (struct socketio_handle *sh, struct telnetclient *cl)
 pull data from socket into buffer.
static void telnetclient_setprompt (struct telnetclient *cl, const char *prompt)
 undocumented - please add documentation.
static void telnetclient_setuser (struct telnetclient *cl, struct user *u)
 replaces the current user with a different one and updates the reference counts.
static void telnetclient_start_lineinput (struct telnetclient *cl, void(*line_input)(struct telnetclient *cl, const char *line), const char *prompt)
 undocumented - please add documentation.
static void telnetclient_start_menuinput (struct telnetclient *cl, struct menuinfo *menu)
 undocumented - please add documentation.
static int telnetclient_telnet_init (struct telnetclient *cl)
 posts telnet protocol necessary to begin negotiation of options.
EXPORT const char * telnetclient_username (struct telnetclient *cl)
EXPORT int telnetclient_vprintf (struct telnetclient *cl, const char *fmt, va_list ap)
 undocumented - please add documentation.
EXPORT void telnetclient_write_event (struct socketio_handle *sh, SOCKET fd, void *p)
 undocumented - please add documentation.
EXPORT void trim_nl (char *line)
 removes a trailing newline if one exists.
EXPORT char * trim_whitespace (char *line)
 remove beginning and trailing whitespace.
static void usage (void)
 display a program usage message and terminated with an exit code.
EXPORT struct useruser_create (const char *username, const char *password, const char *email)
 undocumented - please add documentation.
static struct useruser_defaults (void)
 allocate a default struct.
EXPORT int user_exists (const char *username)
 undocumented - please add documentation.
static void user_free (struct user *u)
 undocumented - please add documentation.
EXPORT void user_get (struct user *user)
 increment the reference count.
EXPORT int user_init (void)
 undocumented - please add documentation.
static int user_ll_add (struct user *u)
 insert a user into user_list, but only if it is not already on the list.
static struct useruser_load_byname (const char *username)
 undocumented - please add documentation.
EXPORT struct useruser_lookup (const char *username)
 loads a user into the cache.
EXPORT void user_put (struct user **user)
 decrement a reference count.
EXPORT void user_shutdown (void)
 undocumented - please add documentation.
static int user_write (const struct user *u)
 undocumented - please add documentation.
static const char * util_convertnumber (unsigned n, unsigned base, unsigned pad)
 debug routine to convert a number to a string.
EXPORT int util_fnmatch (const char *pattern, const char *string, int flags)
 clone of the fnmatch() function.
EXPORT const char * util_getword (const char *s, char *out, size_t outlen)
 copies a word into out, silently truncate word if it is too long.
static void util_hexdump (FILE *f, const void *data, int len)
 debug routine to hexdump some bytes.
EXPORT void util_strfile_close (struct util_strfile *h)
 undocumented - please add documentation.
EXPORT void util_strfile_open (struct util_strfile *h, const char *buf)
 undocumented - please add documentation.
EXPORT const char * util_strfile_readline (struct util_strfile *h, size_t *len)
 undocumented - please add documentation.
EXPORT char * util_textfile_load (const char *filename)
 read the contents of a text file into an allocated string.
const char * value_get (enum value_type type, void *p)
 convert a value at p into a string according to type.
int value_set (const char *value, enum value_type type, void *p)
 set a value into p according to type.
static void webserver_close (struct webserver *ws)
 marks a webserver socket as needing to be reaped.
static void webserver_free (struct socketio_handle *sh, void *p)
 free a struct webserver client connection.
EXPORT int webserver_init (int family, unsigned port)
 initialize the webserver module by binding a listening socket for the server.
static void webserver_new_event (struct socketio_handle *sh)
 create a new webserver on a new connection event from a listening socket.
static struct webserverwebserver_newclient (struct socketio_handle *sh)
 creates a new webserver client connections from a socketio_handle.
static void webserver_read_event (struct socketio_handle *sh, SOCKET fd, void *extra)
 try to fill the input buffers on a read-ready event.
EXPORT void webserver_shutdown (void)
 delete the the server's socketio_handle.
static void webserver_write_event (struct socketio_handle *sh, SOCKET fd, void *extra)
 empty the buffers into a socket on a write-ready event.

Variables

void(* b_log )(int priority, const char *domain, const char *fmt,...) = b_log_dummy
static uint8_t * base64dec_tab
static const uint8_t base64enc_tab [64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
struct plugin_channel_interface channel
static struct plugin_basic_classchannel_owner
struct plugin_character_interface character
static struct plugin_basic_classcharacter_owner
static FILE * eventlog_file
 undocumented - please add documentation.
struct plugin_fdb_interface fdb
static struct plugin_basic_classfdb_owner
static int fl_default_family = 0
 undocumented - please add documentation.
static struct formform_newuser_app
 undocumented - please add documentation.
static struct menuinfo
gamemenu_login 
gamemenu_main
 undocumented - please add documentation.
static struct heapqueue_elm heap [512]
 undocumented - please add documentation.
static unsigned heap_len
 undocumented - please add documentation.
static sig_atomic_t keep_going_fl = 1
 flag used for the main loop, zero to terminated.
static struct plugin_list plugin_list
struct plugin_room_interface room
static struct plugin_basic_classroom_owner
static struct socketio_handlewebserver_listen_handle
 the listening socket for the webserver.


Detailed Description

A plugin oriented MUD.

Author:
Jon Mayo <jon.mayo@gmail.com>
Version:
0.5
Date:
2008-2009
Copyright 2008 Jon Mayo

This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.

1. Definitions The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. A "contribution" is the original software, or any additions or changes to the software. A "contributor" is any person that distributes its contribution under this license. "Licensed patents" are a contributor's patent claims that read directly on its contribution. 2. Grant of Rights (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. 3. Conditions and Limitations (A) Reciprocal Grants- For any file you distribute that contains code from the software (in source code or binary format), you must provide recipients the source code to that file along with a copy of this license, which license will govern that file. You may license other files that are entirely your own work and do not contain code from the software under any terms you choose. (B) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. (C) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. (D) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. (E) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. (F) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.

http://www.microsoft.com/opensource/licenses.mspx#Ms-RL

Definition in file boris.c.


Define Documentation

#define _make_name ( x,
 )     _make_name2(x,y)

_make_name is used by var.

Definition at line 254 of file boris.c.

#define _make_name2 ( x,
 )     x##y

_make_name2 is used by VAR and _make_name.

Definition at line 251 of file boris.c.

#define _make_string (  )     _make_string2(x)

_make_string is used to turn an value into a string.

Definition at line 260 of file boris.c.

#define _make_string2 (  )     #x

_make_string2 is used by _make_string

Definition at line 257 of file boris.c.

#define ABORT   '\356'

undocumented - please add documentation.

Definition at line 2663 of file boris.c.

#define AO   '\365'

undocumented - please add documentation.

Definition at line 2642 of file boris.c.

#define AYT   '\366'

undocumented - please add documentation.

Definition at line 2639 of file boris.c.

#define BITCLR ( x,
bit   )     (x)[(bit)/((CHAR_BIT*sizeof *(x)))]&=~(1<<((bit)&((CHAR_BIT*sizeof *(x))-1)))

clear bit position 'bit' in bitfield x

Definition at line 347 of file boris.c.

#define BITFIELD ( bits,
type   )     (((bits)+(CHAR_BIT*sizeof(type))-1)/(CHAR_BIT*sizeof(type)))

return in type sized elements to create a bitfield of 'bits' bits.

Definition at line 341 of file boris.c.

#define BITINV ( x,
bit   )     (x)[(bit)/((CHAR_BIT*sizeof *(x)))]^=1<<((bit)&((CHAR_BIT*sizeof *(x))-1))

toggle bit position 'bit' in bitfield x.

Definition at line 350 of file boris.c.

#define BITMAP_BITSIZE   (sizeof(unsigned)*CHAR_BIT)

size in bits of a group of bits for struct bitmap.

Definition at line 2213 of file boris.c.

#define BITRANGE ( x,
bit   )     ((bit)<(sizeof(x)*CHAR_BIT))

checks that bit is in range for bitfield x.

Definition at line 356 of file boris.c.

#define BITSET ( x,
bit   )     (x)[(bit)/((CHAR_BIT*sizeof *(x)))]|=1<<((bit)&((CHAR_BIT*sizeof *(x))-1))

set bit position 'bit' in bitfield x.

Definition at line 344 of file boris.c.

#define BITTEST ( x,
bit   )     ((x)[(bit)/((CHAR_BIT*sizeof *(x)))]&(1<<((bit)&((CHAR_BIT*sizeof *(x))-1))))

return a large non-zero number if the bit is set, zero if clear.

Definition at line 353 of file boris.c.

#define BORIS_VERSION_MAJ   0

Definition at line 71 of file boris.c.

#define BORIS_VERSION_MIN   5

Definition at line 72 of file boris.c.

#define BORIS_VERSION_PAT   0

Definition at line 73 of file boris.c.

#define BORIS_VERSION_STR

Value:

Definition at line 272 of file boris.c.

#define BREAK   '\363'

undocumented - please add documentation.

Definition at line 2648 of file boris.c.

#define DEBUG ( msg,
...   )     fprintf(stderr, "DEBUG:%s():%d:" msg, __func__, __LINE__, ## __VA_ARGS__);

DEBUG() prints a formatted message to stderr if NDEBUG is not defined.

Definition at line 373 of file boris.c.

#define DEBUG_MSG ( msg   )     fprintf(stderr, "ERROR:%s():%d:" msg "\n", __func__, __LINE__);

DEBUG_MSG prints a string and newline to stderr if NDEBUG is not defined.

Definition at line 376 of file boris.c.

 
#define DIE (  )     do { ERROR_MSG("abort!"); abort(); } while(0)

DIE - print the function and line number then abort.

Definition at line 418 of file boris.c.

#define DM   '\362'

undocumented - please add documentation.

Definition at line 2651 of file boris.c.

#define DO   '\375'

undocumented - please add documentation.

Definition at line 2618 of file boris.c.

#define DONT   '\376'

undocumented - please add documentation.

Definition at line 2615 of file boris.c.

#define EC   '\367'

undocumented - please add documentation.

Definition at line 2636 of file boris.c.

#define EL   '\370'

undocumented - please add documentation.

Definition at line 2633 of file boris.c.

#define EOR   '\357'

undocumented - please add documentation.

Definition at line 2660 of file boris.c.

#define ERROR_FMT ( msg,
...   )     fprintf(stderr, "ERROR:%s():%d:" msg, __func__, __LINE__, __VA_ARGS__);

ERROR_FMT() prints a formatted message to stderr.

Definition at line 397 of file boris.c.

#define ERROR_MSG ( msg   )     fprintf(stderr, "ERROR:%s():%d:" msg "\n", __func__, __LINE__);

ERROR_MSG prints a string and newline to stderr.

Definition at line 400 of file boris.c.

#define EXPORT

tag a function as being an exported symbol.

Definition at line 280 of file boris.c.

#define FAILON ( e,
reason,
label   )     do { if(e) { fprintf(stderr, "FAILED:%s:%s\n", reason, strerror(errno)); goto label; } } while(0)

tests an expression, if failed prints an error message based on errno and jumps to a label.

Definition at line 412 of file boris.c.

#define FORM_FLAG_HIDDEN   1

Definition at line 5833 of file boris.c.

#define FORM_FLAG_INVISIBLE   2

Definition at line 5834 of file boris.c.

#define FOURCC ( a,
b,
c,
 ) 

Value:

( \
    ((uint_least32_t)(d)<<24) \
    |((uint_least32_t)(c)<<16) \
    |((uint_least32_t)(b)<<8) \
    |(a))
make four ASCII characters into a 32-bit integer.

Definition at line 244 of file boris.c.

#define GA   '\371'

undocumented - please add documentation.

Definition at line 2630 of file boris.c.

#define GCC_ONLY (  ) 

this version defined if not using GCC.

Definition at line 459 of file boris.c.

#define HEAPQUEUE_LEFT (  )     (2*(i)+1)

undocumented - please add documentation.

Definition at line 1307 of file boris.c.

#define HEAPQUEUE_PARENT (  )     (((i)-1)/2)

undocumented - please add documentation.

Definition at line 1313 of file boris.c.

#define HEAPQUEUE_RIGHT (  )     (2*(i)+2)

undocumented - please add documentation.

Definition at line 1310 of file boris.c.

#define HEXDUMP ( data,
len,
...   )     do { fprintf(stderr, __VA_ARGS__); util_hexdump(stderr, data, len); } while(0)

HEXDUMP() outputs a message and block of hexdump data to stderr if NDEBUG is not defined.

Definition at line 379 of file boris.c.

#define HEXDUMP_TRACE ( data,
len,
...   )     HEXDUMP(data, len, __VA_ARGS__)

HEXDUMP_TRACE() does a hexdump to stderr if NTRACE is not defined.

Definition at line 389 of file boris.c.

#define IAC   '\377'

undocumented - please add documentation.

Todo:
prefix these to clean up the namespace

Definition at line 2612 of file boris.c.

#define INVALID_SOCKET   (-1)

undocumented - please add documentation.

Definition at line 4028 of file boris.c.

#define IP   '\364'

undocumented - please add documentation.

Definition at line 2645 of file boris.c.

#define JUNKINIT ( ptr,
len   )     memset((ptr), 0xBB, (len));

initialize with junk - used to find unitialized values.

Definition at line 423 of file boris.c.

#define LM_FORWARDMASK   2

undocumented - please add documentation.

Definition at line 2708 of file boris.c.

#define LM_MODE   1

undocumented - please add documentation.

Definition at line 2705 of file boris.c.

#define LM_SLC   3

undocumented - please add documentation.

Definition at line 2711 of file boris.c.

#define MKDIR (  )     mkdir(d, 0777)

macro used to wrap mkdir() function from UNIX and Windows

Definition at line 175 of file boris.c.

#define MODE_ACK   4

undocumented - please add documentation.

Definition at line 2722 of file boris.c.

#define MODE_EDIT   1

undocumented - please add documentation.

Definition at line 2716 of file boris.c.

#define MODE_LIT_ECHO   16

undocumented - please add documentation.

Definition at line 2728 of file boris.c.

#define MODE_MASK   31

undocumented - please add documentation.

Definition at line 2731 of file boris.c.

#define MODE_SOFT_TAB   8

undocumented - please add documentation.

Definition at line 2725 of file boris.c.

#define MODE_TRAPSIG   2

undocumented - please add documentation.

Definition at line 2719 of file boris.c.

#define NOP   '\361'

undocumented - please add documentation.

Definition at line 2654 of file boris.c.

#define PERROR ( msg   )     fprintf(stderr, "ERROR:%s():%d:%s:%s\n", __func__, __LINE__, msg, strerror(errno));

logs a message based on errno

Definition at line 415 of file boris.c.

#define PLUGIN_NAME_MAX   64

Definition at line 6826 of file boris.c.

#define RD_BE16 ( src,
offset   )     ((((src)[offset]&255u)<<8)|((src)[(offset)+1]&255u))

ReaD Big-Endian 16-bit value.

Definition at line 318 of file boris.c.

#define RD_BE32 ( src,
offset   ) 

Value:

(\
    (((src)[offset]&255ul)<<24) \
    |(((src)[(offset)+1]&255ul)<<16) \
    |(((src)[(offset)+2]&255ul)<<8) \
    |((src)[(offset)+3]&255ul))
ReaD Big-Endian 32-bit value.

Definition at line 321 of file boris.c.

#define RD_BE64 ( src,
offset   ) 

Value:

(\
        (((src)[offset]&255ull)<<56) \
        |(((src)[(offset)+1]&255ull)<<48) \
        |(((src)[(offset)+2]&255ull)<<40) \
        |(((src)[(offset)+3]&255ull)<<32) \
        |(((src)[(offset)+4]&255ull)<<24) \
        |(((src)[(offset)+5]&255ull)<<16) \
        |(((src)[(offset)+6]&255ull)<<8) \
        |((src)[(offset)+7]&255ull))
ReaD Big-Endian 64-bit value.

Definition at line 328 of file boris.c.

#define REFCOUNT_GET ( obj   )     do { (obj)->REFCOUNT_NAME++; } while(0)

undocumented - please add documentation.

Definition at line 451 of file boris.c.

#define REFCOUNT_INIT ( obj   )     ((obj)->REFCOUNT_NAME=0)

undocumented - please add documentation.

Definition at line 437 of file boris.c.

#define REFCOUNT_NAME   _referencecount

undocumented - please add documentation.

Definition at line 434 of file boris.c.

#define REFCOUNT_PUT ( obj,
free_action   ) 

Value:

do { \
        assert((obj)->REFCOUNT_NAME>0); \
        if(--(obj)->REFCOUNT_NAME<=0) { \
            free_action; \
        } \
    } while(0)
undocumented - please add documentation.

Definition at line 443 of file boris.c.

#define REFCOUNT_TAKE ( obj   )     ((obj)->REFCOUNT_NAME++)

undocumented - please add documentation.

Definition at line 440 of file boris.c.

#define REFCOUNT_TYPE   int

undocumented - please add documentation.

Definition at line 431 of file boris.c.

#define ROL ( f,
v,
 )     ((((v)<<(b))|((v)>>((f)-(b))))&(0xfffffffful>>(32-(f))))

rotate a value in an f-bit field left by b bits.

truncate to 32-bits.

Definition at line 2854 of file boris.c.

#define ROL32 ( v,
 )     ROL(32, v, b)

Definition at line 2858 of file boris.c.

#define SB   '\372'

undocumented - please add documentation.

Definition at line 2627 of file boris.c.

#define SE   '\360'

undocumented - please add documentation.

Definition at line 2657 of file boris.c.

#define SHA1_DIGEST_LENGTH   20

size of a SHA-1 digest in bytes.

SHA-1 is 160-bit.

Definition at line 2835 of file boris.c.

#define SHA1_K0   0x5a827999

SHA-1 Constants.

Definition at line 2845 of file boris.c.

#define SHA1_K1   0x6ed9eba1

Definition at line 2846 of file boris.c.

#define SHA1_K2   0x8f1bbcdc

Definition at line 2847 of file boris.c.

#define SHA1_K3   0xca62c1d6

Definition at line 2848 of file boris.c.

#define SHA1_LBLOCK   16

number of 32-bit values in a 512-bit block.

Definition at line 2840 of file boris.c.

#define SHA1CRYPT_BITS   128

Number of bits used by SHA-1.

Definition at line 3111 of file boris.c.

#define SHA1CRYPT_GENSALT_LEN   6

undocumented - please add documentation.

Definition at line 3114 of file boris.c.

#define SHA1CRYPT_GENSALT_MAX   16

undocumented - please add documentation.

Definition at line 3117 of file boris.c.

#define SHA1PASSWD_MAGIC   "{SSHA}"

prefix for salted SHA1 password hash.

Definition at line 3120 of file boris.c.

#define SHA1PASSWD_MAGIC_LEN   6

length of SHA1PASSWD_MAGIC.

Definition at line 3123 of file boris.c.

#define SHA1PASSWD_MAX   (SHA1PASSWD_MAGIC_LEN+((SHA1_DIGEST_LENGTH+SHA1CRYPT_GENSALT_MAX+3)/4*4)*4/3+1)

maximum length of crypted password including null termination.

Definition at line 3126 of file boris.c.

#define SHVAR_ESCAPE   '$'

escape character used.

Definition at line 1230 of file boris.c.

#define SHVAR_ID_MAX   128

maximum number of characters in a $().

Definition at line 1227 of file boris.c.

#define SOCKET_ERROR   (-1)

undocumented - please add documentation.

Definition at line 4031 of file boris.c.

#define SOCKETIO_FAILON ( e,
reason,
fail_label   )     do { if(e) { fprintf(stderr, "ERROR:%s:%s\n", reason, socketio_strerror()); goto fail_label; } } while(0)

undocumented - please add documentation.

Definition at line 4035 of file boris.c.

#define SOCKETIO_LISTEN_QUEUE   10

number of connections that can be queues waiting for accept().

Definition at line 179 of file boris.c.

#define SOEXT   ".so"

Definition at line 1043 of file boris.c.

#define SUSP   '\355'

undocumented - please add documentation.

Definition at line 2666 of file boris.c.

#define SYNCH   '\362'

undocumented - please add documentation.

Definition at line 2672 of file boris.c.

#define TELNETCLIENT_INPUT_BUFFER_SZ   256

undocumented - please add documentation.

Definition at line 185 of file boris.c.

#define TELNETCLIENT_OUTPUT_BUFFER_SZ   4096

undocumented - please add documentation.

Definition at line 182 of file boris.c.

#define TELOPT_ECHO   1

undocumented - please add documentation.

Definition at line 2677 of file boris.c.

#define TELOPT_LINEMODE   34

undocumented - please add documentation.

Definition at line 2689 of file boris.c.

#define TELOPT_NAWS   31

undocumented - please add documentation.

Definition at line 2686 of file boris.c.

#define TELOPT_SGA   3

undocumented - please add documentation.

Definition at line 2680 of file boris.c.

#define TELOPT_TTYPE   24

undocumented - please add documentation.

Definition at line 2683 of file boris.c.

#define TELQUAL_INFO   2

undocumented - please add documentation.

Definition at line 2700 of file boris.c.

#define TELQUAL_IS   0

undocumented - please add documentation.

Definition at line 2694 of file boris.c.

#define TELQUAL_SEND   1

undocumented - please add documentation.

Definition at line 2697 of file boris.c.

#define TODO ( msg   )     fprintf(stderr, "TODO:%s():%d:" msg "\n", __func__, __LINE__);

TODO prints a string and newline to stderr.

Definition at line 403 of file boris.c.

#define TRACE ( f,
...   )     fprintf(stderr, "TRACE:%s():%u:" f, __func__, __LINE__, __VA_ARGS__)

TRACE() prints a message to stderr if NTRACE is not defined.

Definition at line 387 of file boris.c.

 
#define TRACE_ENTER (  )     TRACE("%u:ENTER\n", __LINE__);

trace logs entry to a function if NTRACE is not defined.

Definition at line 406 of file boris.c.

 
#define TRACE_EXIT (  )     TRACE("%u:EXIT\n", __LINE__);

trace logs exit of a function if NTRACE is not defined.

Definition at line 409 of file boris.c.

#define TRACE_MSG (  )     TRACE("%s\n", m);

TRACE_MSG() prints a message and newline to stderr if NTRACE is not defined.

Definition at line 394 of file boris.c.

#define UNUSED   GCC_ONLY(__attribute__((unused)))

macro to mark function parameters as unused, used to supress warnings.

Definition at line 463 of file boris.c.

#define USE_BSD_SOCKETS

detected system with BSD compatible sockets.

Definition at line 172 of file boris.c.

#define USER_FLAGS_NEWUSER   mud_config.newuser_flags

default flags for new users.

Definition at line 3368 of file boris.c.

#define USER_LEVEL_NEWUSER   mud_config.newuser_level

user:configuration

default level for new users.

Definition at line 3365 of file boris.c.

#define UTIL_FNM_CASEFOLD   16

util_fnmatch accepts this as a paramter to perform case insensitive matches.

Definition at line 729 of file boris.c.

#define UTIL_FNM_NOMATCH   1

util_fnmatch returns this value when a match was not found.

Definition at line 726 of file boris.c.

#define VAR (  )     _make_name(x,__LINE__)

VAR() is used for making temp variables in macros.

Definition at line 263 of file boris.c.

#define VERBOSE ( ...   )     fprintf(stderr, __VA_ARGS__)

undocumented - please add documentation.

Definition at line 364 of file boris.c.

#define WILL   '\373'

undocumented - please add documentation.

Definition at line 2624 of file boris.c.

#define WONT   '\374'

undocumented - please add documentation.

Definition at line 2621 of file boris.c.

#define WR_BE16 ( dest,
offset,
value   ) 

Value:

do { \
        unsigned VAR(tmp)=value; \
        (dest)[offset]=(VAR(tmp)/256)%256; \
        (dest)[(offset)+1]=VAR(tmp)%256; \
    } while(0)
WRite Big-Endian 16-bit value.

Definition at line 298 of file boris.c.

#define WR_BE32 ( dest,
offset,
value   ) 

Value:

do { \
        unsigned VAR(tmp)=value; \
        (dest)[offset]=(VAR(tmp)/16777216L)%256; \
        (dest)[(offset)+1]=(VAR(tmp)/65536L)%256; \
        (dest)[(offset)+2]=(VAR(tmp)/256)%256; \
        (dest)[(offset)+3]=VAR(tmp)%256; \
    } while(0)
WRite Big-Endian 32-bit value.

Definition at line 289 of file boris.c.

#define WR_BE64 ( dest,
offset,
value   ) 

Value:

do { \
        unsigned long long VAR(tmp)=value; \
        (dest)[offset]=((VAR(tmp))>>56)&255; \
        (dest)[(offset)+1]=((VAR(tmp))>>48)&255; \
        (dest)[(offset)+2]=((VAR(tmp))>>40)&255; \
        (dest)[(offset)+3]=((VAR(tmp))>>32)&255; \
        (dest)[(offset)+4]=((VAR(tmp))>>24)&255; \
        (dest)[(offset)+5]=((VAR(tmp))>>16)&255; \
        (dest)[(offset)+6]=((VAR(tmp))>>8)&255; \
        (dest)[(offset)+7]=(VAR(tmp))&255; \
    } while(0)
WRite Big-Endian 64-bit value.

Definition at line 305 of file boris.c.

#define xEOF   '\354'

undocumented - please add documentation.

Definition at line 2669 of file boris.c.


Typedef Documentation

typedef int(* dll_func_t)()

Definition at line 1038 of file boris.c.

typedef void* dll_symbol_t

Definition at line 1039 of file boris.c.

typedef int SOCKET

define SOCKET on POSIX systems because Winsock2 uses this typedef too, but it is good to remember that ws2's sockets are unsigned int handles while POSIX/BSD systems use a signed int, with -1 as flag value for an unused or freed socket.

Definition at line 4025 of file boris.c.


Function Documentation

static int acs_check ( struct acs_info ai,
const char *  acsstring 
) [static]

undocumented - please add documentation.

Definition at line 2559 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void acs_init ( struct acs_info ai,
unsigned  level,
unsigned  flags 
) [static]

undocumented - please add documentation.

Definition at line 2538 of file boris.c.

Here is the caller graph for this function:

void acs_test ( void   ) 

undocumented - please add documentation.

Definition at line 2594 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int acs_testflag ( struct acs_info ai,
unsigned  flag 
) [static]

undocumented - please add documentation.

Definition at line 2544 of file boris.c.

Here is the caller graph for this function:

int attr_add ( struct attr_list *  al,
const char *  name,
const char *  value 
)

add an entry to the end, preserves the order.

refuse to add a duplicate entry.

< duplicate found, refuse to add.

< out of memory.

< out of memory.

< out of memory.

< success.

Definition at line 3293 of file boris.c.

Here is the caller graph for this function:

struct attr_entry* attr_find ( struct attr_list *  al,
const char *  name 
) [read]

find an attr by name.

Definition at line 3278 of file boris.c.

Here is the caller graph for this function:

void attr_list_free ( struct attr_list *  al  ) 

free every element on the list.

Definition at line 3342 of file boris.c.

Here is the caller graph for this function:

static void b_log_dummy ( int priority  UNUSED,
const char *domain  UNUSED,
const char *  fmt,
  ... 
) [static]

a default log function to use if none is defined.

Definition at line 568 of file boris.c.

Here is the caller graph for this function:

EXPORT int base64_decode ( size_t  in_len,
const char *  in,
size_t  out_len,
unsigned char *  out 
)

< use 255 indicates a bad value.

Definition at line 2775 of file boris.c.

Here is the caller graph for this function:

EXPORT int base64_encode ( size_t  in_len,
const unsigned char *  in,
size_t  out_len,
char *  out 
)

base64_encodes as .

/0123456789a-zA-Z.

Definition at line 2744 of file boris.c.

Here is the caller graph for this function:

EXPORT void bitmap_clear ( struct bitmap bitmap,
unsigned  ofs,
unsigned  len 
)

set a range of bits to 0.

Parameters:
bitmap the bitmap structure.
ofs first bit to clear.
len number of bits to clear.

Definition at line 2280 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT void bitmap_free ( struct bitmap bitmap  ) 

free a bitmap structure.

Definition at line 2238 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT int bitmap_get ( struct bitmap bitmap,
unsigned  ofs 
)

gets a single bit.

Parameters:
bitmap the bitmap structure.
ofs the index of the bit.
Returns:
0 or 1 depending on value of the bit.

Definition at line 2357 of file boris.c.

EXPORT void bitmap_init ( struct bitmap bitmap  ) 

initialize an bitmap structure to be empty.

Definition at line 2229 of file boris.c.

Here is the caller graph for this function:

EXPORT unsigned bitmap_length ( struct bitmap bitmap  ) 

Get the length (in bytes) of the bitmap table.

Returns:
the length in bytes of the entire bitmap table.

Definition at line 2455 of file boris.c.

EXPORT void bitmap_loadmem ( struct bitmap bitmap,
unsigned char *  d,
size_t  len 
)

loads a chunk of memory into the bitmap structure.

erases previous bitmap buffer, resizes bitmap buffer to make room if necessary.

Parameters:
bitmap the bitmap structure.
d a buffer to use for initializing the bitmap.
len length in bytes of the buffer d.

Definition at line 2416 of file boris.c.

Here is the call graph for this function:

EXPORT int bitmap_next_clear ( struct bitmap bitmap,
unsigned  ofs 
)

scan a bitmap structure for the next clear bit.

Parameters:
bitmap the bitmap structure.
ofs the index of the bit to begin scanning.
Returns:
the position of the next cleared bit. -1 if the end of the bits was reached

Definition at line 2393 of file boris.c.

Here is the caller graph for this function:

EXPORT int bitmap_next_set ( struct bitmap bitmap,
unsigned  ofs 
)

scan a bitmap structure for the next set bit.

Parameters:
bitmap the bitmap structure.
ofs the index of the bit to begin scanning.
Returns:
the position of the next set bit. -1 if the end of the bits was reached

Definition at line 2371 of file boris.c.

Here is the caller graph for this function:

EXPORT int bitmap_resize ( struct bitmap bitmap,
size_t  newbits 
)

resize (grow or shrink) a struct bitmap.

Parameters:
bitmap the bitmap structure.
newbits is in bits (not bytes).

Definition at line 2251 of file boris.c.

Here is the caller graph for this function:

EXPORT void bitmap_set ( struct bitmap bitmap,
unsigned  ofs,
unsigned  len 
)

set a range of bits to 1.

Parameters:
bitmap the bitmap structure.
ofs first bit to set.
len number of bits to set.

Definition at line 2319 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT void bitmap_test ( void   ) 

unit tests for struct bitmap data structure.

Definition at line 2463 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT unsigned buffer_consume ( struct buffer b,
size_t  len 
)

Returns:
the remaining data in the buffer

Definition at line 3919 of file boris.c.

Here is the caller graph for this function:

EXPORT const char* buffer_data ( struct buffer b,
size_t *  len 
)

undocumented - please add documentation.

Definition at line 3886 of file boris.c.

Here is the caller graph for this function:

EXPORT void buffer_emit ( struct buffer b,
size_t  len 
)

commits data to buffer.

Definition at line 3936 of file boris.c.

Here is the caller graph for this function:

static char* buffer_findnl ( char *  d,
size_t *  len,
size_t(*)(const char *data, size_t len, void *p)  iac_process,
void *  p 
) [static]

callback returns the number of items consumed.

if a line is incomplete (which it will be if an IAC is incomplete, then return NULL

Definition at line 3951 of file boris.c.

Here is the caller graph for this function:

EXPORT void buffer_free ( struct buffer b  ) 

free the buffer.

Definition at line 3750 of file boris.c.

Here is the caller graph for this function:

EXPORT const char* buffer_getline ( struct buffer b,
size_t *  consumed_len,
size_t(*)(const char *data, size_t len, void *p)  iac_process,
void *  p 
)

undocumented - please add documentation.

Definition at line 3999 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT void buffer_init ( struct buffer b,
size_t  max 
)

undocumented - please add documentation.

Definition at line 3740 of file boris.c.

Here is the caller graph for this function:

static int buffer_ll_expandnl ( struct buffer b,
size_t  len 
) [static]

expand newlines into CR/LF startin at used.

Returns:
length of processed string or -1 on overflow

Definition at line 3761 of file boris.c.

Here is the caller graph for this function:

EXPORT char* buffer_load ( struct buffer b,
size_t *  len 
)

used for adding more data to the buffer.

Returns:
a pointer to the start of the buffer
Parameters:
b a buffer
len the amount remaining in the buffer

Definition at line 3904 of file boris.c.

Here is the caller graph for this function:

static int buffer_printf ( struct buffer b,
const char *  fmt,
  ... 
) [static]

printfs data in a client's output buffer.

Definition at line 3876 of file boris.c.

Here is the call graph for this function:

static int buffer_puts ( struct buffer b,
const char *  str 
) [static]

puts data in a client's output buffer.

Definition at line 3834 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT int buffer_vprintf ( struct buffer b,
const char *  fmt,
va_list  ap 
)

printfs and expands newline to CR/LF.

Definition at line 3841 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT int buffer_write ( struct buffer b,
const char *  str,
size_t  len 
)

writes data and exapands newline to CR/LF.

Definition at line 3802 of file boris.c.

Here is the caller graph for this function:

EXPORT int buffer_write_noexpand ( struct buffer b,
const void *  data,
size_t  len 
)

special write that does not expand its input.

unlike the other calls, truncation will not load partial data into a buffer

Definition at line 3786 of file boris.c.

Here is the caller graph for this function:

static int command_do_character ( struct telnetclient cl,
struct user u,
const char *cmd  UNUSED,
const char *  arg 
) [static]

Definition at line 5563 of file boris.c.

Here is the call graph for this function:

static int command_do_chsay ( struct telnetclient cl,
struct user u,
const char *cmd  UNUSED,
const char *  arg 
) [static]

undocumented - please add documentation.

Definition at line 5516 of file boris.c.

Here is the call graph for this function:

static int command_do_emote ( struct telnetclient cl,
struct user u,
const char *cmd  UNUSED,
const char *  arg 
) [static]

undocumented - please add documentation.

Definition at line 5508 of file boris.c.

Here is the call graph for this function:

static int command_do_pose ( struct telnetclient cl,
struct user u,
const char *cmd  UNUSED,
const char *  arg 
) [static]

undocumented - please add documentation.

Definition at line 5480 of file boris.c.

Here is the call graph for this function:

static int command_do_quit ( struct telnetclient cl,
struct user *u  UNUSED,
const char *cmd  UNUSED,
const char *arg  UNUSED 
) [static]

undocumented - please add documentation.

Todo:
the close code needs to change the state so telnetclient_isstate does not end up being true for a future read?

Definition at line 5525 of file boris.c.

Here is the call graph for this function:

static int command_do_roomget ( struct telnetclient cl,
struct user u,
const char *cmd  UNUSED,
const char *  arg 
) [static]

undocumented - please add documentation.

Definition at line 5535 of file boris.c.

Here is the call graph for this function:

static int command_do_say ( struct telnetclient cl,
struct user u,
const char *cmd  UNUSED,
const char *  arg 
) [static]

undocumented - please add documentation.

Definition at line 5496 of file boris.c.

Here is the call graph for this function:

static int command_do_yell ( struct telnetclient cl,
struct user u,
const char *cmd  UNUSED,
const char *  arg 
) [static]

undocumented - please add documentation.

Definition at line 5488 of file boris.c.

Here is the call graph for this function:

static int command_execute ( struct telnetclient cl,
struct user u,
const char *  line 
) [static]

executes a command for user u.

Todo:
support cl as NULL for silent/offline commands

Definition at line 5674 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void command_lineinput ( struct telnetclient cl,
const char *  line 
) [static]

undocumented - please add documentation.

Todo:
pass current user and character

Definition at line 5725 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int command_not_implemented ( struct telnetclient cl,
struct user *u  UNUSED,
const char *cmd  UNUSED,
const char *arg  UNUSED 
) [static]

undocumented - please add documentation.

Definition at line 5612 of file boris.c.

Here is the call graph for this function:

static int command_run ( struct telnetclient cl,
struct user u,
const char *  cmd,
const char *  arg 
) [static]

use cmd to run a command from the command_table array.

Definition at line 5658 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT void command_start ( void *  p,
long unused2  UNUSED,
void *unused3  UNUSED 
)

undocumented - please add documentation.

Definition at line 5750 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void command_start_lineinput ( struct telnetclient cl  )  [static]

undocumented - please add documentation.

Definition at line 5743 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT void config_free ( struct config cfg  ) 

undocumented - please add documentation.

Definition at line 2067 of file boris.c.

Here is the caller graph for this function:

EXPORT int config_load ( const char *  filename,
struct config cfg 
)

undocumented - please add documentation.

Definition at line 2093 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT void config_setup ( struct config cfg  ) 

undocumented - please add documentation.

Definition at line 2062 of file boris.c.

Here is the caller graph for this function:

static void config_test ( void   )  [static]

undocumented - please add documentation.

Definition at line 2199 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int config_test_show ( struct config *cfg  UNUSED,
void *extra  UNUSED,
const char *  id,
const char *  value 
) [static]

undocumented - please add documentation.

Definition at line 2193 of file boris.c.

Here is the caller graph for this function:

EXPORT void config_watch ( struct config cfg,
const char *  mask,
int(*)(struct config *cfg, void *extra, const char *id, const char *value)  func,
void *  extra 
)

adds a watcher with a shell style mask.

func can return 0 to end the chain, or return 1 if the operation should continue on

Definition at line 2081 of file boris.c.

Here is the caller graph for this function:

EXPORT void dll_close ( dll_handle_t  h  ) 

closes an open DLL file handle.

ignores NULL handles.

Parameters:
h handle to close
See also:
dll_open

Definition at line 1121 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT int dll_open ( dll_handle_t h,
const char *  filename 
)

opens a file and updates the handle at h.

file extension is optional, and it is best not to specify it.

Parameters:
h pointer to the handle to be updated. set to NULL on failure.
filename name of the DLL file to open. should not contain an extension, that will be added.
Returns:
non-zero on success, 0 on failure.
See also:
dll_close

Definition at line 1086 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void dll_show_error ( const char *  reason  )  [static]

internal function for reporting errors on last operation with a DLL.

See also:
dll_open dll_close

Definition at line 1051 of file boris.c.

Here is the caller graph for this function:

EXPORT dll_symbol_t dll_symbol ( dll_handle_t  h,
const char *  name 
)

get a function's address from a DLL.

name must by a symbol name for a function.

Parameters:
h handle
name a symbol name, must be a function.
Returns:
NULL on error. address of exported symbol on success.

Definition at line 1144 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int do_config_msg ( struct config *cfg  UNUSED,
void *extra  UNUSED,
const char *  id,
const char *  value 
) [static]

undocumented - please add documentation.

Definition at line 6614 of file boris.c.

Here is the caller graph for this function:

static int do_config_msgfile ( struct config *cfg  UNUSED,
void *extra  UNUSED,
const char *  id,
const char *  value 
) [static]

undocumented - please add documentation.

Definition at line 6647 of file boris.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int do_config_port ( struct config *cfg  UNUSED,
void *extra  UNUSED,
const char *  id,
const char *  value 
) [static]

handles the 'server.port' property.

Definition at line 6692 of file boris.c.

Here is the call graph for this function: