#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <dlfcn.h>
#include "commands.h"
#include "debug.h"
#include "dynstuff.h"
#include "plugins.h"
#include "stuff.h"
#include "vars.h"
#include "themes.h"
#include "xmalloc.h"
#include "dynstuff_inline.h"
#include "queries.h"
Funkcje |
static int | plugin_register_compare (plugin_t *data1, plugin_t *data2) |
| DYNSTUFF_LIST_DECLARE_SORTED_NF (plugins, plugin_t, plugin_register_compare, static __DYNSTUFF_LIST_ADD_SORTED, __DYNSTUFF_NOUNLINK) EXPORTNOT list_t watches |
static int | ekg2_dlclose (void *plugin) |
static void * | ekg2_dlopen (const char *name) |
static void * | ekg2_dlsym (void *plugin, char *name) |
EXPORTNOT void | plugin_load (const char *name) |
EXPORTNOT plugin_t * | remote_plugin_load (const char *name, int prio) |
EXPORTNOT void | remote_plugins_destroy () |
plugin_t * | plugin_find (const char *name) |
int | plugin_register (plugin_t *p, int prio) |
EXPORTNOT void | plugin_unload (plugin_t *p) |
int | plugin_unregister (plugin_t *p) |
query_t * | query_connect_id (plugin_t *plugin, const int id, query_handler_func_t *handler, void *data) |
EXPORTNOT void | queries_destroy () |
int | query_emit_id (plugin_t *plugin, const int id,...) |
static watch_t * | watch_find (plugin_t *plugin, int fd, watch_type_t type) |
static | LIST_FREE_ITEM (watch_free_data, watch_t *) |
EXPORTNOT void | watch_free (watch_t *w) |
EXPORTNOT void | watch_handle (watch_t *w) |
EXPORTNOT int | watch_write (watch_t *w, const char *buf, int len) |
EXPORTNOT void | watches_destroy () |
watch_t * | watch_add (plugin_t *plugin, int fd, watch_type_t type, watcher_handler_func_t *handler, void *data) |
int | watch_remove (plugin_t *plugin, int fd, watch_type_t type) |
int | plugin_abi_version (int plugin_abi_ver, const char *plugin_name) |
Zmienne |
static query_t * | queries [QUERY_EXTERNAL+1] |
EXPORTNOT plugin_t * | ui_plugin = NULL |
plugin_t * | plugins = NULL |
Dokumentacja funkcji
DYNSTUFF_LIST_DECLARE_SORTED_NF |
( |
plugins |
, |
|
|
plugin_t |
, |
|
|
plugin_register_compare |
, |
|
|
static |
__DYNSTUFF_LIST_ADD_SORTED, |
|
|
__DYNSTUFF_NOUNLINK |
|
|
) |
| |
static int ekg2_dlclose |
( |
void * |
plugin | ) |
[static] |
static void* ekg2_dlopen |
( |
const char * |
name | ) |
[static] |
static void* ekg2_dlsym |
( |
void * |
plugin, |
|
|
char * |
name |
|
) |
| [static] |
static LIST_FREE_ITEM |
( |
watch_free_data |
, |
|
|
watch_t * |
|
|
) |
| [static] |
int plugin_abi_version |
( |
int |
plugin_abi_ver, |
|
|
const char * |
plugin_name |
|
) |
| |
plugin_t* plugin_find |
( |
const char * |
name | ) |
|
plugin_find()
Find plugin by name
- Parametry:
-
- Zwraca:
- plugin_t with given name, or NULL if not found.
EXPORTNOT void plugin_load |
( |
const char * |
name | ) |
|
int plugin_register |
( |
plugin_t * |
p, |
|
|
int |
prio |
|
) |
| |
static int plugin_register_compare |
( |
plugin_t * |
data1, |
|
|
plugin_t * |
data2 |
|
) |
| [static] |
EXPORTNOT void plugin_unload |
( |
plugin_t * |
p | ) |
|
EXPORTNOT void queries_destroy |
( |
| ) |
|
int query_emit_id |
( |
plugin_t * |
plugin, |
|
|
const int |
id, |
|
|
|
... |
|
) |
| |
EXPORTNOT plugin_t* remote_plugin_load |
( |
const char * |
name, |
|
|
int |
prio |
|
) |
| |
EXPORTNOT void remote_plugins_destroy |
( |
| ) |
|
watch_add()
Create new watch_t and add it on the beginning of watches list.
- Parametry:
-
plugin | - plugin |
fd | - fd to watch data for. |
type | - type of watch. |
handler | - handler of watch. |
data | - data which be passed to handler. |
- Zwraca:
- Created watch_t. if type is either WATCH_READ_LINE or WATCH_WRITE_LINE than also allocate memory for buffer
EXPORTNOT void watch_free |
( |
watch_t * |
w | ) |
|
EXPORTNOT void watch_handle |
( |
watch_t * |
w | ) |
|
watch_handle()
Handler for watches with type: WATCH_READ or WATCH_WRITE
Mark watch with w->removed = -1, to indicate that watch is in use. And it shouldn't be executed again. [If watch can or even must be executed twice from ekg_loop() than you must change w->removed by yourself.]
If handler of watch return -1 or watch was removed inside function [by watch_remove() or watch_free()]. Than it'll be removed.
ELSE Update w->started field to current time.
- Parametry:
-
- Do zrobienia:
- We only check for w->removed == -1, maybe instead change it to: w->removed != 0
EXPORTNOT int watch_write |
( |
watch_t * |
w, |
|
|
const char * |
buf, |
|
|
int |
len |
|
) |
| |
EXPORTNOT void watches_destroy |
( |
| ) |
|
Dokumentacja zmiennych