#define CM_RANGE(Message, Which) Message->cm_fields[Which], \
Message->cm_fields[Which] + Message->cm_lengths[Which]
-void CtdlSerializeMessage(struct ser_ret *, struct CtdlMessage *);
+// Serialization routines use this struct to return a pointer and a length
+struct ser_ret {
+ size_t len; // length of allocation
+ unsigned char *ser; // pointer to allocation
+ unsigned char *msgstart; // pointer to the "M" (message text) field
+};
+
+struct ser_ret CtdlSerializeMessage(struct CtdlMessage *);
struct CtdlMessage *CtdlDeserializeMessage(long msgnum, int with_body, const char *Buffer, long Length);
void ReplicationChecks(struct CtdlMessage *);
int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newmsgs,
int do_repl_check, struct CtdlMessage *supplied_msg, int suppress_refcount_adj
);
int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int do_repl_check, struct CtdlMessage *msg);
-long CtdlSaveThisMessage(struct CtdlMessage *msg, long msgid, int Reply);
char *CtdlReadMessageBody(char *terminator, long tlen, size_t maxlen, StrBuf *exist, int crlf);
StrBuf *CtdlReadMessageBodyBuf(
char *terminator, // token signalling EOT