| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
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

## Macros
#define | ws_pipe_handle int
#define | ws_get_pipe_handle(pipe_fd) (pipe_fd)

## Typedefs
typedef struct _ws_pipe_t | ws_pipe_t

## 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

## 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_fd | File 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_pipe | The process PID, stdio descriptors, etc.
  args | The 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.