- Made init function in ascon handle errors

- Minor fixes to scriptcontext.c
This commit is contained in:
koennecke
2008-06-11 13:37:13 +00:00
parent e8a2d09aa6
commit 31e4a58870
6 changed files with 50 additions and 645 deletions

14
ascon.i
View File

@ -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