--- lmtp.h 2001/07/17 12:40:07 1.1
+++ lmtp.h 2001/07/23 12:14:06 1.2
@@ -1,3 +1,4 @@
+
#ifndef __LMTP_H__
#define __LMTP_H__
@@ -16,37 +17,39 @@
} lmtp_io_t;
typedef struct {
- char *verb;
- char *msg;
+ char *verb; /* verb found */
+ char *msg; /* wholly message including verb */
} lmtp_req_t;
typedef struct {
- int rc;
- char *dsn;
- char *msg;
+ char *statuscode; /* digit digit digit NUL */
+ char *dsncode; /* digit dot digit dot digit NUL */
+ char *statusmsg; /* message with >=0*NLs, not terminating with NL. NUL */
} lmtp_res_t;
typedef enum {
LMTP_OK,
- LMTP_ERR_SYSTEM, /* see errno */
- LMTP_ERR_INVALID_VERB
+ LMTP_EOF, /* eof */
+ LMTP_ERR_SYSTEM, /* see errno */
+ LMTP_ERR_MEM, /* dynamic memory allocation failed */
+ LMTP_ERR_OVERFLOW, /* static allocated memory exhausted */
+ LMTP_ERR_VERB, /* search for verb failed */
+ LMTP_ERR_ARG, /* invalid arg was passed to function */
+ LMTP_ERR_UNKNOWN /* guru meditation */
} lmtp_rc_t;
-typedef enum {
- LMTP_TYPE_SINGLELINE,
- LMTP_TYPE_MULTILINE
-} lmtp_type_t;
-
typedef lmtp_rc_t (*lmtp_cb_t)(lmtp_io_t *io, lmtp_req_t *req, lmtp_res_t *res, void *ctx);
lmtp_t *lmtp_create (int rfd, int wfd, lmtp_io_t *io);
void lmtp_destroy (lmtp_t *lmtp);
+lmtp_rc_t lmtp_readline(lmtp_t *lmtp, char *buf, size_t buflen);
+lmtp_rc_t lmtp_readmsg (lmtp_t *lmtp, char *buf, size_t buflen);
lmtp_rc_t lmtp_request (lmtp_t *lmtp, lmtp_req_t *req);
-lmtp_rc_t lmtp_result (lmtp_t *lmtp, lmtp_res_t *res);
+lmtp_rc_t lmtp_response(lmtp_t *lmtp, lmtp_res_t *res);
char **lmtp_message (lmtp_t *lmtp, char *verb);
void lmtp_reset (lmtp_t *lmtp);
char *lmtp_error (lmtp_t *lmtp, lmtp_rc_t rc);
-lmtp_cb_t lmtp_register(lmtp_t *lmtp, char *verb, lmtp_type_t type, lmtp_cb_t *cb, void *ctx);
+lmtp_rc_t lmtp_register(lmtp_t *lmtp, char *verb, lmtp_cb_t cb, void *ctx, lmtp_cb_t *oldcb, void **oldctx);
lmtp_rc_t lmtp_loop (lmtp_t *lmtp);
#endif /* __LMTP_H__ */
|