- added AsconHostport function

- added composite terminator in standard protocol
This commit is contained in:
zolliker
2012-06-19 06:31:06 +00:00
parent 3141f63f20
commit 36d1204da0
3 changed files with 70 additions and 11 deletions

14
ascon.i
View File

@ -55,6 +55,7 @@ typedef int (* AsconHandler)(Ascon *connection);
struct Ascon {
AsconState state; /**< the current state */
int fd; /**< socket */
int conState; /**< 1: connection refused, 0: else */
int readState; /**< (std) last char was CR */
pDynString rdBuffer; /**< read buffer */
pDynString wrBuffer; /**< write buffer */
@ -73,6 +74,7 @@ struct Ascon {
char lastChar; /**< last char read */
char *separator; /**< (std) separator for multiline responses */
int lineCount; /**< number of lines expected (counting down) */
int compositeTerminator; /**< the terminator contains several chars */
void *private; /**< private data of protocol */
void (*killPrivate)(void *); /**< kill function for private */
};
@ -116,6 +118,8 @@ int AsconStdHandler(Ascon *a);
* if no replyTerminator is given, or if it is empty, CR, LF or CR/LF all are detected
* as terminators. If the terminator is CR, LF or CR/LF, it is removed from the result,
* all other terminators are kept in the result.
* is the first and the last character are single quotes (') is is treated as a composite
* terminator and not as a list of single character terminators
* separator is used for multiline responses. If this parameter
* is given (and not empty) a command may be followed by a line count in curly brackets,
* indicating that a multiline response is expected. All the lines of the response are
@ -180,4 +184,14 @@ int AsconWriteChars(int fd, char *data, int length);
*/
void AsconError(Ascon *a, char *msg, int errorno);
int AsconInterpreteArgs(int argc, char *argv[],
int parc, char *parn[], char *pars[]);
/**
* Treat hex strings as terminators right. Note that this
* is limited to single character terminators.
*/
void AsconCheckTerminators(Ascon *a);
#endif