1 | <?php |
||
12 | class RawConnection { |
||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | private $command; |
||
17 | |||
18 | /** |
||
19 | * @var string[] |
||
20 | */ |
||
21 | private $env; |
||
22 | |||
23 | /** |
||
24 | * @var resource[] $pipes |
||
25 | * |
||
26 | * $pipes[0] holds STDIN for smbclient |
||
27 | * $pipes[1] holds STDOUT for smbclient |
||
28 | */ |
||
29 | private $pipes; |
||
30 | |||
31 | /** |
||
32 | * @var resource $process |
||
33 | */ |
||
34 | private $process; |
||
35 | |||
36 | 774 | public function __construct($command, $env = array()) { |
|
41 | |||
42 | 774 | private function connect() { |
|
63 | |||
64 | /** |
||
65 | * check if the connection is still active |
||
66 | * |
||
67 | * @return bool |
||
68 | */ |
||
69 | 774 | public function isValid() { |
|
77 | |||
78 | /** |
||
79 | * send input to the process |
||
80 | * |
||
81 | * @param string $input |
||
82 | */ |
||
83 | 762 | public function write($input) { |
|
87 | |||
88 | /** |
||
89 | * read a line of output |
||
90 | * |
||
91 | * @return string |
||
92 | */ |
||
93 | 771 | public function readLine() { |
|
96 | |||
97 | /** |
||
98 | * read a line of output |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | public function readError() { |
||
105 | |||
106 | /** |
||
107 | * get all output until the process closes |
||
108 | * |
||
109 | * @return array |
||
110 | */ |
||
111 | 15 | public function readAll() { |
|
118 | |||
119 | 762 | public function getInputStream() { |
|
122 | |||
123 | 771 | public function getOutputStream() { |
|
126 | |||
127 | public function getErrorStream() { |
||
130 | |||
131 | 774 | public function getAuthStream() { |
|
134 | |||
135 | 48 | public function getFileInputStream() { |
|
138 | |||
139 | 48 | public function getFileOutputStream() { |
|
142 | |||
143 | 774 | public function writeAuthentication($user, $password) { |
|
155 | |||
156 | 774 | public function close($terminate = true) { |
|
177 | |||
178 | 3 | public function reconnect() { |
|
182 | |||
183 | 774 | public function __destruct() { |
|
186 | } |
||
187 |