driver.h~

MudOSa4DGD/mudlib/dgd/lib/include/driver.h~ · 1.4 KB

From the archive MudOSa4DGD-30.06.98.tar.gz

Download the archive   « Back to the archive contents

/*
 * driver.h
 *
 * Include file for DriverLib objects (/dgd/ objects very close to the driver)
 *
 * (C) Frank Schmidt, Jesus@NorseMUD
 *
 */

#ifndef _DRIVER_H
#define _DRIVER_H

#include <dgd_dirs.h>
#include <objects.h>


/* default rlimits calls from driver objects (values defined in config.h) */
#define RLIMITS_ON()         rlimits(DEFAULT_CALL_STACK ; DEFAULT_TICK_LIMIT) {
#define RLIMITS_OFF()        }

/* Declaring this scope will avoid running out of rlimits at critical code */
#define NO_RLIMITS_ON()      rlimits(-1 ; -1) {
#define NO_RLIMITS_OFF()     }


/*
 * Check for AUTO and DriverLib call_other privileges. This is a HIGHLY
 * efficient security scheme, but it requires that arbitrary (variable object
 * or function) call_other in any DriverLib object to be made with a 
 * __call_other(ob, func, args...)
 */
/* call from the AUTO program? */
#define AUTO_PRIV()          (previous_program() == AUTO && \
                              previous_function() != "__call_other")

/* check wether <f> is a DriverLib filename? */
#ifndef DEFAULT_DGD_DIR
# define IS_DRIVER_SOURCE(f)  (strcocmp(_DGD_DIR, (f)))
#else /* optimize for /dgd/ directory (default) */
# define IS_DRIVER_SOURCE(f)  (strlen(f) >= 5 && (f)[0..4] == "/dgd/")
#endif

/* call from a DriverLib program? */
#define DRIVER_PRIV()        (IS_DRIVER_SOURCE(previous_program()) && \
                              previous_function() != "__call_other")


#endif

Site Stats

Snippets: 1791
Codebases: 571