1 | <?php |
||
13 | class RawConnection { |
||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private $command; |
||
18 | |||
19 | /** |
||
20 | * @var string[] |
||
21 | */ |
||
22 | private $env; |
||
23 | |||
24 | /** |
||
25 | * @var resource[] $pipes |
||
26 | * |
||
27 | * $pipes[0] holds STDIN for smbclient |
||
28 | * $pipes[1] holds STDOUT for smbclient |
||
29 | * $pipes[3] holds the authfile for smbclient |
||
30 | * $pipes[4] holds the stream for writing files |
||
31 | * $pipes[5] holds the stream for reading files |
||
32 | */ |
||
33 | private $pipes; |
||
34 | |||
35 | /** |
||
36 | * @var resource $process |
||
37 | */ |
||
38 | private $process; |
||
39 | |||
40 | /** |
||
41 | * @var resource|null $authStream |
||
42 | */ |
||
43 | private $authStream = null; |
||
44 | |||
45 | private $connected = false; |
||
46 | |||
47 | 1040 | public function __construct($command, array $env = []) { |
|
51 | |||
52 | 1040 | public function connect() { |
|
79 | |||
80 | /** |
||
81 | * check if the connection is still active |
||
82 | * |
||
83 | * @return bool |
||
84 | */ |
||
85 | 1040 | public function isValid() { |
|
93 | |||
94 | /** |
||
95 | * send input to the process |
||
96 | * |
||
97 | * @param string $input |
||
98 | */ |
||
99 | 1024 | public function write($input) { |
|
103 | |||
104 | /** |
||
105 | * read a line of output |
||
106 | * |
||
107 | * @return string|false |
||
108 | */ |
||
109 | 1040 | public function readLine() { |
|
112 | |||
113 | /** |
||
114 | * read a line of output |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | public function readError() { |
||
121 | |||
122 | /** |
||
123 | * get all output until the process closes |
||
124 | * |
||
125 | * @return array |
||
126 | */ |
||
127 | 20 | public function readAll() { |
|
134 | |||
135 | 1024 | public function getInputStream() { |
|
138 | |||
139 | 1040 | public function getOutputStream() { |
|
142 | |||
143 | public function getErrorStream() { |
||
146 | |||
147 | 1040 | public function getAuthStream() { |
|
150 | |||
151 | 64 | public function getFileInputStream() { |
|
154 | |||
155 | 64 | public function getFileOutputStream() { |
|
158 | |||
159 | 1040 | public function writeAuthentication($user, $password) { |
|
167 | |||
168 | 1040 | public function close($terminate = true) { |
|
189 | |||
190 | 4 | public function reconnect() { |
|
194 | |||
195 | 1040 | public function __destruct() { |
|
198 | } |
||
199 |