libextractor  1.11
About: GNU libextractor is a library used to extract meta-data from files of arbitrary type.
  Fossies Dox: libextractor-1.11.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

extractor_ipc_w32.c File Reference
#include "platform.h"
#include "plibc.h"
#include "extractor.h"
#include "extractor_datasource.h"
#include "extractor_plugin_main.h"
#include "extractor_plugins.h"
#include "extractor_ipc.h"
#include "extractor_logging.h"
Include dependency graph for extractor_ipc_w32.c:

Go to the source code of this file.

Data Structures

struct  EXTRACTOR_SharedMemory
struct  EXTRACTOR_Channel


#define PIPE_BUF   512


struct EXTRACTOR_SharedMemoryEXTRACTOR_IPC_shared_memory_create_ (size_t size)
unsigned int EXTRACTOR_IPC_shared_memory_change_rc_ (struct EXTRACTOR_SharedMemory *shm, int delta)
void EXTRACTOR_IPC_shared_memory_destroy_ (struct EXTRACTOR_SharedMemory *shm)
ssize_t EXTRACTOR_IPC_shared_memory_set_ (struct EXTRACTOR_SharedMemory *shm, struct EXTRACTOR_Datasource *ds, uint64_t off, size_t size)
uint64_t EXTRACTOR_datasource_get_pos_ (struct EXTRACTOR_Datasource *ds)
static int create_selectable_pipe (PHANDLE read_pipe_ptr, PHANDLE write_pipe_ptr, LPSECURITY_ATTRIBUTES sa_ptr, DWORD psize, DWORD dwReadMode, DWORD dwWriteMode)
static int write_plugin_data (struct EXTRACTOR_PluginList *plugin, struct EXTRACTOR_Channel *channel)
struct EXTRACTOR_ChannelEXTRACTOR_IPC_channel_create_ (struct EXTRACTOR_PluginList *plugin, struct EXTRACTOR_SharedMemory *shm)
void EXTRACTOR_IPC_channel_destroy_ (struct EXTRACTOR_Channel *channel)
ssize_t EXTRACTOR_IPC_channel_send_ (struct EXTRACTOR_Channel *channel, const void *data, size_t size)
int EXTRACTOR_IPC_channel_recv_ (struct EXTRACTOR_Channel **channels, unsigned int num_channels, EXTRACTOR_ChannelMessageProcessor proc, void *proc_cls)

Macro Definition Documentation


#define PIPE_BUF   512

Definition at line 260 of file extractor_ipc_w32.c.

Function Documentation

◆ create_selectable_pipe()

static int create_selectable_pipe ( PHANDLE  read_pipe_ptr,
PHANDLE  write_pipe_ptr,
DWORD  psize,
DWORD  dwReadMode,
DWORD  dwWriteMode 

Definition at line 274 of file extractor_ipc_w32.c.

References PIPE_BUF.

Referenced by EXTRACTOR_IPC_channel_create_().

◆ EXTRACTOR_datasource_get_pos_()

uint64_t EXTRACTOR_datasource_get_pos_ ( struct EXTRACTOR_Datasource ds)

Query datasource for current position

dsdata source to query
current position in the datasource or UINT_MAX on error

Definition at line 250 of file extractor_ipc_w32.c.

References EXTRACTOR_datasource_seek_(), and EXTRACTOR_SharedMemory::pos.

◆ EXTRACTOR_IPC_channel_create_()

◆ EXTRACTOR_IPC_channel_destroy_()

◆ EXTRACTOR_IPC_channel_recv_()

int EXTRACTOR_IPC_channel_recv_ ( struct EXTRACTOR_Channel **  channels,
unsigned int  num_channels,
EXTRACTOR_ChannelMessageProcessor  proc,
void *  proc_cls 

Receive data from any of the given IPC channels (blocking). Wait for one of the plugins to reply. Selects on plugin output pipes, runs 'receive_reply' on each activated pipe until it gets a seek request or a done message. Called repeatedly by the user until all pipes are dry or broken.

channelsarray of channels, channels that break may be set to NULL
num_channelslength of the 'channels' array
procfunction to call to process messages (may be called more than once)
proc_clsclosure for 'proc'
-1 on error, 1 on success

Definition at line 695 of file extractor_ipc_w32.c.

References EXTRACTOR_PluginList::channel, EXTRACTOR_Channel::cpipe_out, EXTRACTOR_IPC_channel_destroy_(), EXTRACTOR_IPC_process_reply_(), EXTRACTOR_PluginList::libname, LOG, LOG_STRERROR, MAX_META_DATA, EXTRACTOR_Channel::mdata, EXTRACTOR_Channel::mdata_size, NULL, EXTRACTOR_Channel::ov_read, EXTRACTOR_Channel::plugin, EXTRACTOR_PluginList::round_finished, EXTRACTOR_PluginList::seek_request, and EXTRACTOR_Channel::size.

Referenced by do_extract().

◆ EXTRACTOR_IPC_channel_send_()

ssize_t EXTRACTOR_IPC_channel_send_ ( struct EXTRACTOR_Channel channel,
const void *  data,
size_t  size 

Send data via the given IPC channel (blocking).

channelchannel to communicate with the plugin
bufdata to send
sizenumber of bytes in buf to send
-1 on error, number of bytes sent on success (never does partial writes)

Definition at line 629 of file extractor_ipc_w32.c.

References EXTRACTOR_Channel::cpipe_in, LOG_STRERROR, NULL, EXTRACTOR_Channel::old_buf, and EXTRACTOR_Channel::ov_write.

Referenced by do_extract(), EXTRACTOR_IPC_channel_create_(), process_plugin_reply(), send_discard_message(), send_update_message(), and write_plugin_data().

◆ EXTRACTOR_IPC_shared_memory_change_rc_()

unsigned int EXTRACTOR_IPC_shared_memory_change_rc_ ( struct EXTRACTOR_SharedMemory shm,
int  delta 

Change the reference counter for this shm instance.

shminstance to update
deltavalue to change RC by
new RC

Definition at line 189 of file extractor_ipc_w32.c.

References EXTRACTOR_SharedMemory::rc.

Referenced by EXTRACTOR_extract(), and EXTRACTOR_plugin_remove().

◆ EXTRACTOR_IPC_shared_memory_create_()

struct EXTRACTOR_SharedMemory* EXTRACTOR_IPC_shared_memory_create_ ( size_t  size)

◆ EXTRACTOR_IPC_shared_memory_destroy_()

void EXTRACTOR_IPC_shared_memory_destroy_ ( struct EXTRACTOR_SharedMemory shm)

Destroy shared memory area.

shmmemory area to destroy
NULL on error

Definition at line 204 of file extractor_ipc_w32.c.

References EXTRACTOR_SharedMemory::map, NULL, EXTRACTOR_SharedMemory::ptr, EXTRACTOR_SharedMemory::shm_id, EXTRACTOR_SharedMemory::shm_name, EXTRACTOR_SharedMemory::shm_ptr, and EXTRACTOR_SharedMemory::shm_size.

Referenced by EXTRACTOR_plugin_remove().

◆ EXTRACTOR_IPC_shared_memory_set_()

ssize_t EXTRACTOR_IPC_shared_memory_set_ ( struct EXTRACTOR_SharedMemory shm,
struct EXTRACTOR_Datasource ds,
uint64_t  off,
size_t  size 

Initialize shared memory area from data source.

shmmemory area to initialize
dsdata source to use for initialization
offoffset to use in data source
sizenumber of bytes to copy
-1 on error, otherwise number of bytes copied

Definition at line 224 of file extractor_ipc_w32.c.

References EXTRACTOR_datasource_read_(), EXTRACTOR_datasource_seek_(), LOG, EXTRACTOR_SharedMemory::ptr, EXTRACTOR_SharedMemory::shm_ptr, and EXTRACTOR_SharedMemory::shm_size.

Referenced by do_extract().

◆ write_plugin_data()

static int write_plugin_data ( struct EXTRACTOR_PluginList plugin,
struct EXTRACTOR_Channel channel 

Communicates plugin data (library name, options) to the plugin process. This is only necessary on W32, where this information is not inherited by the plugin, because it is not forked.

pluginplugin context
0 on success, -1 on failure

Definition at line 376 of file extractor_ipc_w32.c.

References EXTRACTOR_IPC_channel_send_(), EXTRACTOR_PluginList::libname, NULL, EXTRACTOR_PluginList::plugin_options, EXTRACTOR_SharedMemory::ptr, and EXTRACTOR_PluginList::short_libname.

Referenced by EXTRACTOR_IPC_channel_create_().