plugin.h File Reference

The commotiond plugin loader. More...

#include <stdlib.h>
#include "obj.h"

Go to the source code of this file.

Classes

struct  co_plugin_t
 

Typedefs

typedef struct co_plugin_t co_plugin_t
 

Functions

struct co_plugin_t __attribute__ ((packed))
 
int co_plugins_shutdown (void)
 shuts down and closes all plugins
 
int co_plugins_start (void)
 starts all loaded plugins
 
int co_plugins_init (size_t index_size)
 initializes global plugin list More...
 
int co_plugins_load (const char *dir_path)
 loads all plugins in specified path More...
 

Variables

co_obj_t _header
 
uint8_t _exttype
 
uint8_t _len
 
co_obj_tname
 
co_obj_tfilename
 
co_cb_t shutdown
 
co_cb_t init
 
void * handle
 

Detailed Description

The commotiond plugin loader.

Author
Josh King (jheretic), jking.nosp@m.@cha.nosp@m.mbana.nosp@m..net

Function Documentation

int co_plugins_init ( size_t  index_size)

initializes global plugin list

Parameters
index_sizespecifies size of index for plugins list (16 or 32 bit)

References co_plugins_shutdown().

Referenced by main().

95 {
96  if(index_size == 16)
97  {
98  CHECK((_plugins = (co_obj_t *)co_list16_create()) != NULL, "Plugin list creation failed.");
99  }
100  else if(index_size == 32)
101  {
102  CHECK((_plugins = (co_obj_t *)co_list32_create()) != NULL, "Plugin list creation failed.");
103  }
104  else SENTINEL("Invalid list index size.");
105 
106  return 1;
107 
108 error:
110  return 0;
111 }
int co_plugins_shutdown(void)
shuts down and closes all plugins
Definition: plugin.c:63
Definition: obj.h:131
int co_plugins_load ( const char *  dir_path)

loads all plugins in specified path

Parameters
dir_pathdirectory to load plugins from

References process_files().

Referenced by main().

153  {
154  return process_files(dir_path, _co_plugins_load_i);
155 }
int process_files(const char *dir_path, file_iter loader)
processes file paths
Definition: util.c:145

Variable Documentation

co_obj_t* name

command name