Go to the source code of this file.
|
| void | WritePacket (int fd, char type, const char *message) |
| | Writes a packet in above form. More...
|
| |
| char | ReadPacket (int fd, char **message, int eof_permitted) |
| | Reads a packet in above form. More...
|
| |
◆ PTYPE_ERROR_MESSAGE
| #define PTYPE_ERROR_MESSAGE 'e' |
◆ PTYPE_INFO_MESSAGE
| #define PTYPE_INFO_MESSAGE 'i' |
◆ PTYPE_PROMPT_LIKE_PASSWORD
| #define PTYPE_PROMPT_LIKE_PASSWORD 'P' |
◆ PTYPE_PROMPT_LIKE_USERNAME
| #define PTYPE_PROMPT_LIKE_USERNAME 'U' |
◆ PTYPE_RESPONSE_CANCELLED
| #define PTYPE_RESPONSE_CANCELLED 'x' |
◆ PTYPE_RESPONSE_LIKE_PASSWORD
| #define PTYPE_RESPONSE_LIKE_PASSWORD 'p' |
◆ PTYPE_RESPONSE_LIKE_USERNAME
| #define PTYPE_RESPONSE_LIKE_USERNAME 'u' |
◆ ReadPacket()
| char ReadPacket |
( |
int |
fd, |
|
|
char ** |
message, |
|
|
int |
eof_permitted |
|
) |
| |
Reads a packet in above form.
- Parameters
-
| fd | The file descriptor to write to. |
| message | A pointer to store the message (will be mlock()d). Will always be set if function returns nonzero; caller must free it. |
| eof_permitted | If enabled, encountering EOF at the beginning will not count as an error but return 0 silently. |
- Returns
- The packet type, or 0 if no packet has been read. Errors are logged.
◆ WritePacket()
| void WritePacket |
( |
int |
fd, |
|
|
char |
type, |
|
|
const char * |
message |
|
) |
| |
Writes a packet in above form.
- Parameters
-
| fd | The file descriptor to write to. |
| type | The packet type from above macros. |
| message | The message to include with the packet (NUL-terminated). |