/* Adapted from phk@freebsd.dk's public domain implementation. */
+#include <stdlib.h>
#include <string.h>
#include "msgproc.h"
base64_start(msgproc *m)
{
struct b64_state *b64s = malloc(sizeof(b64s));
- base64_start(b64s);
+ b64_start(b64s);
msgproc_setpriv(m, (void *)b64s);
}
static void
-base64_process(msgproc *m, char *buf, int len)
+base64_process(msgproc *m, char *buf, size_t len)
{
char tmp[2048];
int tmplen, ret;
}
static void
-base64_finish(struct msgproc_stage *m)
+base64_finish(msgproc *m)
{
struct b64_state *b64s = msgproc_getpriv(m);
if (b64s) {
* All Rights Reserved, for now.
*/
+#include <stdlib.h>
#include "msgproc.h"
msgproc *
}
void
-msgproc_module_set(msgproc_module *m, void *data, size_t dsiz)
+msgproc_module_set(msgproc_module *m, int key, void *data, size_t dsiz)
{
- if (m) m->mpm_set(data, dsiz);
+ if (m) m->mpm_set(key, data, dsiz);
}
void
* All Rights Reserved, for now.
*/
-type struct _msgproc_s msgproc;
+#include <sys/types.h>
+
+typedef struct _msgproc_s msgproc;
+
+typedef enum {
+ MSGPROC_MESSAGE,
+ MSGPROC_PART,
+ MSGPROC_MULTIPART,
+ MSGPROC_BASE64,
+ MSGPROC_QUOTED_PRINTABLE,
+ MSGPROC_TEXT,
+ MSGPROC_HTML
+} msgproc_module_type;
typedef struct {
- int mpm_type;
+ msgproc_module_type mpm_type;
void (*mpm_init)(void);
void (*mpm_set)(int, void *, size_t);
void (*mp_start)(msgproc *);
struct _msgproc_s {
void *mp_priv;
- msgproc_module mp_mod;
+ msgproc_module *mp_mod;
msgproc *mp_prev, *mp_next;
};
msgproc *msgproc_next(msgproc *);
msgproc *msgproc_prev(msgproc *);
-void msgproc_module_init(mgproc_module *);
+void msgproc_module_init(msgproc_module *);
void msgproc_module_set(msgproc_module *, int, void *, size_t);
void msgproc_start(msgproc *);
void msgproc_set(msgproc*, int, void *, size_t);
void msgproc_process(msgproc *, char *, size_t);
void msgproc_finish(msgproc *);
-void msgproc_module_shutdown(mgproc_module *);
+void msgproc_module_shutdown(msgproc_module *);
extern msgproc_module msgproc_text,
msgproc_html,
* All Rights Reserved, for now.
*/
+#include <stdlib.h>
#include <string.h>
#include "msgproc.h"
msgproc_module msgproc_multipart = {
MSGPROC_MULTIPART, /* type */
NULL, /* module init */
- setboundary, /* set module parameter */
+ NULL, /* set module parameter */
multipart_start, /* start module instance */
- NULL, /* set module instance parameter */
+ setboundary, /* set module instance parameter */
multipart_process, /* process data */
multipart_finish, /* shut down, free module instance */
NULL /* shut down, free module */
qp_start(struct qp_state *qps)
{
bzero(qps, sizeof(*qps));
+ return qps;
}
void
/* Stream-based regular expression matching implementation */
#include <pcre.h>
+#include <strings.h>
#include "re_stream.h"
/* TODO: make these runtime tunables, add upper bound for allocation. */
};
struct stream_re *re_stream_start(struct stream_re *, pcre *, int);
-struct stream_re *re_stream_stop(struct stream_re *);
+void re_stream_stop(struct stream_re *);
int re_stream_result(struct stream_re *);
char *re_stream_getresult(struct stream_re *);
+int re_stream_exec(struct stream_re *, char *, int);