Atrinik Server  4.0
Data Structures | Macros | Typedefs | Functions
plugin.h File Reference
#include <dlfcn.h>

Go to the source code of this file.

Data Structures

struct  atrinik_plugin
 

Macros

#define MODULEAPI
 
#define PLUGIN_EVENT_NORMAL   1
 
#define PLUGIN_EVENT_MAP   2
 
#define PLUGIN_EVENT_GLOBAL   3
 
#define PLUGIN_EVENT_UNIT   4
 
#define EVENT_NONE   0
 
#define EVENT_APPLY   1
 
#define EVENT_ATTACK   2
 
#define EVENT_DEATH   3
 
#define EVENT_DROP   4
 
#define EVENT_PICKUP   5
 
#define EVENT_SAY   6
 
#define EVENT_STOP   7
 
#define EVENT_TIME   8
 
#define EVENT_THROW   9
 
#define EVENT_TRIGGER   10
 
#define EVENT_CLOSE   11
 
#define EVENT_QUEST   13
 
#define EVENT_ASK_SHOW   14
 
#define EVENT_AI   15
 
#define EVENT_AI_RANDOM_MOVE   1
 
#define EVENT_AI_GUARD_STOP   2
 
#define MEVENT_ENTER   1
 
#define MEVENT_LEAVE   2
 
#define MEVENT_RESET   3
 
#define MEVENT_SPELL_CAST   4
 
#define MEVENT_SKILL_USED   5
 
#define MEVENT_DROP   6
 
#define MEVENT_PICK   7
 
#define MEVENT_PUT   8
 
#define MEVENT_APPLY   9
 
#define MEVENT_LOGIN   10
 
#define MEVENT_CMD_DROP   11
 
#define MEVENT_CMD_TAKE   12
 
#define MEVENT_EXAMINE   13
 
#define GEVENT_BORN   0
 
#define GEVENT_LOGIN   1
 
#define GEVENT_LOGOUT   2
 
#define GEVENT_PLAYER_DEATH   3
 
#define GEVENT_CACHE_REMOVED   4
 
#define GEVENT_TICK   5
 
#define GEVENT_NUM   6
 
#define EVENT_FLAG(x)   (1U << (x - 1))
 
#define HAS_EVENT(ob, event)   (ob->event_flags & EVENT_FLAG(event))
 
#define LIBPTRTYPE   void *
 
#define plugins_dlopen(fname)   dlopen(fname, RTLD_NOW | RTLD_GLOBAL)
 
#define plugins_dlclose(lib)   dlclose(lib)
 
#define plugins_dlsym(lib, name, type)   dlsym(lib, name)
 
#define plugins_dlerror()   dlerror()
 
#define FILENAME_IS_PLUGIN(_path)   (strstr((_path), "plugin_") && !strcmp((_path) + strlen((_path)) - strlen(PLUGIN_SUFFIX), PLUGIN_SUFFIX))
 

Typedefs

typedef void *(* f_plug_event )(int *type,...)
 
typedef void(* f_plug_prop )(int *type,...)
 
typedef void(* f_plug_init )(struct plugin_hooklist *hooklist)
 
typedef void(* f_plug_pinit )(void)
 
typedef struct atrinik_plugin atrinik_plugin
 

Functions

MODULEAPI void initPlugin (struct plugin_hooklist *hooklist)
 
MODULEAPI void getPluginProperty (int *type,...)
 
MODULEAPI void * triggerEvent (int *type,...)
 
MODULEAPI void postinitPlugin (void)
 
MODULEAPI void closePlugin (void)
 

Detailed Description

Atrinik plugin support header file.

Author
Yann Chachkoff

Definition in file plugin.h.

Macro Definition Documentation

#define EVENT_FLAG (   x)    (1U << (x - 1))

Get an event flag from event number code.

See Also
Event number codes

Definition at line 170 of file plugin.h.

#define FILENAME_IS_PLUGIN (   _path)    (strstr((_path), "plugin_") && !strcmp((_path) + strlen((_path)) - strlen(PLUGIN_SUFFIX), PLUGIN_SUFFIX))

Check if the specified filename is a plugin file.

Definition at line 211 of file plugin.h.

#define HAS_EVENT (   ob,
  event 
)    (ob->event_flags & EVENT_FLAG(event))

Check to see if object has an event in its object::event_flags.

Parameters
obObject.
eventEvent to check.

Definition at line 179 of file plugin.h.

#define LIBPTRTYPE   void *

Library handle.

Definition at line 194 of file plugin.h.

#define plugins_dlclose (   lib)    dlclose(lib)

Unload a shared library.

Definition at line 198 of file plugin.h.

#define plugins_dlerror ( )    dlerror()

Library error.

Definition at line 202 of file plugin.h.

#define plugins_dlopen (   fname)    dlopen(fname, RTLD_NOW | RTLD_GLOBAL)

Load a shared library.

Definition at line 196 of file plugin.h.

#define plugins_dlsym (   lib,
  name,
  type 
)    dlsym(lib, name)

Get a function from a shared library.

Definition at line 200 of file plugin.h.

Typedef Documentation

One loaded plugin.

typedef void*(* f_plug_event)(int *type,...)

Event function.

Definition at line 184 of file plugin.h.

typedef void(* f_plug_init)(struct plugin_hooklist *hooklist)

First function called in a plugin.

Definition at line 188 of file plugin.h.

typedef void(* f_plug_pinit)(void)

Function called after the plugin was initialized.

Definition at line 190 of file plugin.h.

typedef void(* f_plug_prop)(int *type,...)

Property function.

Definition at line 186 of file plugin.h.