Atrinik Server 2.5
Data Structures | Defines | Typedefs | Functions
include/plugin.h File Reference
#include <dlfcn.h>
#include <global.h>

Go to the source code of this file.

Data Structures

struct  plugin_hooklist
struct  atrinik_plugin

Defines

#define MODULEAPI
#define PLUGIN_EVENT_NORMAL   1
#define PLUGIN_EVENT_MAP   2
#define PLUGIN_EVENT_GLOBAL   3
#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_TIMER   12
#define EVENT_QUEST   13
#define EVENT_ASK_SHOW   14
#define EVENT_AI   15
#define EVENT_AI_RANDOM_MOVE   1
#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_NUM   5
#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)   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_api )(int *type,...)
typedef void *(* f_plug_init )(struct plugin_hooklist *hooklist)
typedef void *(* f_plug_pinit )()
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 ()
MODULEAPI void closePlugin ()

Detailed Description

Atrinik plugin support header file.

Author:
Yann Chachkoff

Definition in file plugin.h.


Define Documentation

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

Get an event flag from event number code.

See also:
Event number codes

Definition at line 166 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 356 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 172 of file plugin.h.

#define LIBPTRTYPE   void *

Library handle.

Definition at line 339 of file plugin.h.

#define plugins_dlclose (   lib)    dlclose(lib)

Unload a shared library.

Definition at line 343 of file plugin.h.

#define plugins_dlerror ( )    dlerror()

Library error.

Definition at line 347 of file plugin.h.

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

Load a shared library.

Definition at line 341 of file plugin.h.

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

Get a function from a shared library.

Definition at line 345 of file plugin.h.


Typedef Documentation

One loaded plugin.

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

General API function.

Definition at line 331 of file plugin.h.

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

First function called in a plugin.

Definition at line 333 of file plugin.h.

typedef void*(* f_plug_pinit)()

Function called after the plugin was initialized.

Definition at line 335 of file plugin.h.