const char *target; /* the target of the message (either NULL, or custom defined) */
const char *cmd; /* the cmd/verb of the message (either NULL, or para[0]) */
- size_t parselen; /* the length of the message */
size_t n_para; /* the number of parameters (always at least 1 if a full message) */
const char *para[MAXPARA]; /* parameters vector (starting with cmd as para[0]) */
};
* cmd may not be NULL.
* returns 0 on success, 1 on error.
*/
-int msgbuf_unparse(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned int capmask);
+int msgbuf_unparse(char *buf, size_t buflen, const struct MsgBuf *msgbuf, unsigned int capmask);
/*
* unparse a MsgBuf header plus payload into a buffer.
* cmd may not be NULL.
* returns 0 on success, 1 on error.
*/
-int msgbuf_unparse_fmt(char *buf, size_t buflen, struct MsgBuf *head, unsigned int capmask, const char *fmt, ...) AFP(5, 6);
-int msgbuf_vunparse_fmt(char *buf, size_t buflen, struct MsgBuf *head, unsigned int capmask, const char *fmt, va_list va);
+int msgbuf_unparse_fmt(char *buf, size_t buflen, const struct MsgBuf *head, unsigned int capmask, const char *fmt, ...) AFP(5, 6);
+int msgbuf_vunparse_fmt(char *buf, size_t buflen, const struct MsgBuf *head, unsigned int capmask, const char *fmt, va_list va);
-void msgbuf_unparse_prefix(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned int capmask);
+void msgbuf_unparse_prefix(char *buf, size_t *buflen, const struct MsgBuf *msgbuf, unsigned int capmask);
static inline void
msgbuf_init(struct MsgBuf *msgbuf)
}
}
-static inline void
-msgbuf_append_para(struct MsgBuf *msgbuf, const char *para)
-{
- if (msgbuf->n_para < MAXPARA) {
- msgbuf->para[msgbuf->n_para] = para;
- msgbuf->n_para++;
- }
-}
-
#endif