- Made init function in ascon handle errors
- Minor fixes to scriptcontext.c
This commit is contained in:
14
ascon.i
14
ascon.i
@ -70,6 +70,7 @@ struct Ascon {
|
||||
ErrMsg *curError; /**< the currently active error */
|
||||
double start; /**< unix time when read was started */
|
||||
void *private; /**< private data of protocol */
|
||||
void (*killPrivate)(void *); /** < kill function for private */
|
||||
int noResponse; /**< no response expected */
|
||||
int responseValid; /**< a valid response is ready */
|
||||
AsconHandler handler; /**< handler function */
|
||||
@ -92,11 +93,12 @@ int AsconStdHandler(Ascon *a);
|
||||
|
||||
/** \brief initialize a standard connection
|
||||
* \param a the connection
|
||||
* \param con A connection to print errors too.
|
||||
* \param hostport the tcp/ip address (syntax: host:port)
|
||||
*
|
||||
* In most cases a custom init function may be a wrapper around AsconStdInit
|
||||
*/
|
||||
void AsconStdInit(Ascon *a, int argc, char *argv[]);
|
||||
int AsconStdInit(Ascon *a, SConnection *con, int argc, char *argv[]);
|
||||
|
||||
/** The Ascon Protocol
|
||||
*/
|
||||
@ -104,7 +106,7 @@ typedef struct AsconProtocol {
|
||||
struct AsconProtocol *next;
|
||||
char *name;
|
||||
AsconHandler handler;
|
||||
void (*init)(Ascon *s, int argc, char *argv[]);
|
||||
int (*init)(Ascon *s, SConnection *con, int argc, char *argv[]);
|
||||
} AsconProtocol;
|
||||
|
||||
/** \brief Insert a new protocol into the protocol list
|
||||
@ -145,4 +147,12 @@ int AsconReadChar(int fd, char *chr);
|
||||
*/
|
||||
int AsconWriteChars(int fd, char *data, int length);
|
||||
|
||||
/** \brief store an error
|
||||
* \param a The asynchronous I/O structure to store the
|
||||
* error with
|
||||
* \param msg The error message
|
||||
* \param errorno The error number
|
||||
*/
|
||||
void AsconError(Ascon *a, char *msg, int errorno);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user