1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 06:01:28 +00:00
Files
nmap/nse_macros.h
batrick d0bc640db8 Large recode of nse_init.cc
Now does most of it's work through Lua:

From Nmap-dev: "Many of the changes consist of changing how Nmap interfaces
with Lua that were sometimes awkward or inflexible. Most of the functions 
have been made to be callable directly by Lua which offers many technical
advantages: stack management is alleviated, errors are handled cleanly and
are more descriptive, and there is increased reusability."

Additionally:
   -- Moved all lua_State * symbols from "l" to "L". This is to maintain
      consistency with other Lua libraries (convention) and to make our macros portable.
   -- Moved file system manipulation over to nse_fs.cc (from nse_init.cc)
2008-05-31 02:39:27 +00:00

62 lines
1.6 KiB
C

#ifndef NSE_MACROS
#define NSE_MACROS
#define HOSTRULE "hostrule"
#define HOSTTESTS "hosttests"
#define PORTRULE "portrule"
#define PORTTESTS "porttests"
#define ACTION "action"
#define DESCRIPTION "description"
#define AUTHOR "author"
#define LICENSE "license"
#define RUNLEVEL "runlevel"
#define FILES 1
#define DIRS 2
#define SCRIPT_ENGINE "SCRIPT ENGINE"
#define SCRIPT_ENGINE_LUA "LUA INTERPRETER"
#define SCRIPT_ENGINE_SUCCESS 0
#define SCRIPT_ENGINE_ERROR 2
#define SCRIPT_ENGINE_LUA_ERROR 3
#ifdef WIN32
#define SCRIPT_ENGINE_LUA_DIR "scripts\\"
#else
#define SCRIPT_ENGINE_LUA_DIR "scripts/"
#endif
#define SCRIPT_ENGINE_LIB_DIR "nselib/"
#define SCRIPT_ENGINE_LIBEXEC_DIR "nselib-bin/"
#define SCRIPT_ENGINE_DATABASE "script.db"
#define SCRIPT_ENGINE_EXTENSION ".nse"
#define SCRIPT_ENGINE_LUA_TRY(func) if (func != 0) {\
error("LUA INTERPRETER in %s:%d: %s", __FILE__, __LINE__, (char *)lua_tostring(L, -1));\
return SCRIPT_ENGINE_LUA_ERROR;\
}
#define SCRIPT_ENGINE_TRY(func) if (func != 0) {\
return SCRIPT_ENGINE_ERROR;\
}
#define ARRAY_LEN(a) ((int)(sizeof(a) / sizeof(a[0])))
#define SCRIPT_ENGINE_VERBOSE(msg) if (o.debugging || o.verbose > 0) {msg};
#define SCRIPT_ENGINE_DEBUGGING(msg) if (o.debugging) {msg};
#define MAX_FILENAME_LEN 4096
#define NOT_PRINTABLE '.'
// if the character is not printable
// and the character is not a tab
// and the character is not a new line
// and the character is not a carriage return
// return 0
// otherwise return 1
#define ISPRINT(c) ((!(c > 31 && c < 127) && c != 9 && c != 10 && c != 13)? 0 : 1)
#endif