Botan 1.10.17
unix_cmd.h
Go to the documentation of this file.
1/*
2* Unix Command Execution
3* (C) 1999-2007 Jack Lloyd
4*
5* Distributed under the terms of the Botan license
6*/
7
8#ifndef BOTAN_UNIX_CMD_H__
9#define BOTAN_UNIX_CMD_H__
10
11#include <botan/types.h>
12#include <botan/data_src.h>
13#include <string>
14#include <vector>
15
16namespace Botan {
17
18/**
19* Unix Program Info
20*/
22 {
23 /**
24 * @param n is the name and arguments of what we are going run
25 * @param p is the priority level (lower prio numbers get polled first)
26 */
27 Unix_Program(const char* n, size_t p)
28 { name_and_args = n; priority = p; working = true; }
29
30 /**
31 * The name and arguments for this command
32 */
33 std::string name_and_args;
34
35 /**
36 * Priority: we scan from low to high
37 */
38 size_t priority;
39
40 /**
41 * Does this source seem to be working?
42 */
43 bool working;
44 };
45
46/**
47* Command Output DataSource
48*/
50 {
51 public:
52 size_t read(byte[], size_t);
53 size_t peek(byte[], size_t, size_t) const;
54 bool check_available(size_t n);
55 bool end_of_data() const;
56 std::string id() const;
57
58 int fd() const;
59
60 DataSource_Command(const std::string&,
61 const std::vector<std::string>& paths);
63 private:
64 void create_pipe(const std::vector<std::string>&);
65 void shutdown_pipe();
66
67 const size_t MAX_BLOCK_USECS, KILL_WAIT;
68
69 std::vector<std::string> arg_list;
70 struct pipe_wrapper* pipe;
71 };
72
73}
74
75#endif
size_t read(byte[], size_t)
Definition unix_cmd.cpp:63
bool check_available(size_t n)
Definition unix_cmd.cpp:102
DataSource_Command(const std::string &, const std::vector< std::string > &paths)
Definition unix_cmd.cpp:220
std::string id() const
Definition unix_cmd.cpp:128
size_t peek(byte[], size_t, size_t) const
Definition unix_cmd.cpp:95
Unix_Program(const char *n, size_t p)
Definition unix_cmd.h:27
std::string name_and_args
Definition unix_cmd.h:33