Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
ws_pipe.h File Reference
#include <stdbool.h>
#include "wsutil/processes.h"
#include <glib.h>

Go to the source code of this file.

Classes

struct  _ws_pipe_t
 Represents a spawned child process and its associated I/O channels for inter-process communication. More...

Macros

#define ws_pipe_handle   int
#define ws_get_pipe_handle(pipe_fd)

Typedefs

typedef struct _ws_pipe_t ws_pipe_t
 Represents a spawned child process and its associated I/O channels for inter-process communication.

Functions

WS_DLL_PUBLIC bool ws_pipe_spawn_sync (const char *working_directory, const char *command, unsigned argc, char **args, char **command_output)
 Run a process using g_spawn_sync on UNIX and Linux, and CreateProcess on Windows. Wait for it to finish.
WS_DLL_PUBLIC void ws_pipe_init (ws_pipe_t *ws_pipe)
 Initialize a ws_pipe_t struct. Sets .pid to WS_INVALID_PID and all other members to 0 or NULL.
WS_DLL_PUBLIC GPid ws_pipe_spawn_async (ws_pipe_t *ws_pipe, GPtrArray *args)
 Start a process using g_spawn_sync on UNIX and Linux, and CreateProcess on Windows.
WS_DLL_PUBLIC bool ws_pipe_data_available (int pipe_fd)
 Check to see if a file descriptor has data available.

Detailed Description

Routines for handling pipes.

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

Macro Definition Documentation

◆ ws_get_pipe_handle

#define ws_get_pipe_handle ( pipe_fd)
Value:
(pipe_fd)

Function Documentation

◆ ws_pipe_data_available()

WS_DLL_PUBLIC bool ws_pipe_data_available ( int pipe_fd)

Check to see if a file descriptor has data available.

Parameters
pipe_fdFile descriptor.
Returns
true if data is available or false otherwise.

◆ ws_pipe_init()

WS_DLL_PUBLIC void ws_pipe_init ( ws_pipe_t * ws_pipe)

Initialize a ws_pipe_t struct. Sets .pid to WS_INVALID_PID and all other members to 0 or NULL.

Parameters
ws_pipe[IN] The pipe to initialize.

◆ ws_pipe_spawn_async()

WS_DLL_PUBLIC GPid ws_pipe_spawn_async ( ws_pipe_t * ws_pipe,
GPtrArray * args )

Start a process using g_spawn_sync on UNIX and Linux, and CreateProcess on Windows.

Parameters
ws_pipeThe process PID, stdio descriptors, etc.
argsThe command to run along with its arguments. Must be NULL-terminated.
Returns
A valid PID on success, otherwise WS_INVALID_PID.

◆ ws_pipe_spawn_sync()

WS_DLL_PUBLIC bool ws_pipe_spawn_sync ( const char * working_directory,
const char * command,
unsigned argc,
char ** args,
char ** command_output )

Run a process using g_spawn_sync on UNIX and Linux, and CreateProcess on Windows. Wait for it to finish.

Parameters
[IN]working_directory Initial working directory.
[IN]command Command to run.
[IN]argc Number of arguments for the command, not including the command itself.
[IN]args Arguments for the command, not including the command itself. The last element must be NULL.
[OUT]command_output If not NULL, receives a copy of the command output. Must be g_freed.
Returns
true on success or false on failure.