MEDIUM: spoe: use the new buffer API for the SPOE buffer

The buffer is not used as a forwarding buffer so we can simply map ->i
to ->len and ->p to b_head(). It *seems* that p is never modified, so
that we could even always use b_orig(). This needs to be rechecked.
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index d1323ae..2a4f05e 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -573,10 +573,10 @@
 		goto too_big;
 
 	/* Copy encoded messages, if possible */
-	sz = ctx->buffer->i;
+	sz = b_data(ctx->buffer);
 	if (p + sz >= end)
 		goto too_big;
-	memcpy(p, ctx->buffer->p, sz);
+	memcpy(p, b_head(ctx->buffer), sz);
 	p += sz;
 
 	return (p - frame);
@@ -633,10 +633,10 @@
 		goto end;
 
 	/* Copy encoded messages, if possible */
-	sz = ctx->buffer->i;
+	sz = b_data(ctx->buffer);
 	if (p + sz >= end)
 		goto too_big;
-	memcpy(p, ctx->buffer->p, sz);
+	memcpy(p, b_head(ctx->buffer), sz);
 	p += sz;
 
   end:
@@ -1044,8 +1044,8 @@
 
 	/* Copy encoded actions */
 	len = (end - p);
-	memcpy(SPOE_APPCTX(appctx)->buffer->p, p, len);
-	SPOE_APPCTX(appctx)->buffer->i = len;
+	memcpy(b_head(SPOE_APPCTX(appctx)->buffer), p, len);
+	b_set_data(SPOE_APPCTX(appctx)->buffer, len);
 	p += len;
 
 	/* Transfer the buffer ownership to the SPOE context */
@@ -2212,7 +2212,7 @@
 	struct spoe_message *msg;
 	char   *p, *end;
 
-	p   = ctx->buffer->p;
+	p   = b_head(ctx->buffer);
 	end =  p + agent->rt[tid].frame_size - FRAME_HDR_SIZE;
 
 	if (type == SPOE_MSGS_BY_EVENT) { /* Loop on messages by event */
@@ -2254,7 +2254,7 @@
 
 
 	/* nothing has been encoded for an unfragmented payload */
-	if (!(ctx->flags & SPOE_CTX_FL_FRAGMENTED) && p == ctx->buffer->p)
+	if (!(ctx->flags & SPOE_CTX_FL_FRAGMENTED) && p == b_head(ctx->buffer))
 		goto skip;
 
 	SPOE_PRINTF(stderr, "%d.%06d [SPOE/%-15s] %s: stream=%p"
@@ -2266,7 +2266,7 @@
 		    ctx->spoe_appctx, (agent->rt[tid].frame_size - FRAME_HDR_SIZE),
 		    p - ctx->buffer->p);
 
-	ctx->buffer->i = p - ctx->buffer->p;
+	b_set_data(ctx->buffer, p - b_head(ctx->buffer));
 	ctx->frag_ctx.curmsg = NULL;
 	ctx->frag_ctx.curarg = NULL;
 	ctx->frag_ctx.curoff = 0;
@@ -2287,9 +2287,9 @@
 		    (int)now.tv_sec, (int)now.tv_usec,
 		    agent->id, __FUNCTION__, s, ctx->spoe_appctx,
 		    ctx->frag_ctx.curmsg, ctx->frag_ctx.curarg, ctx->frag_ctx.curoff,
-		    (agent->rt[tid].frame_size - FRAME_HDR_SIZE), p - ctx->buffer->p);
+		    (agent->rt[tid].frame_size - FRAME_HDR_SIZE), p - b_head(ctx->buffer));
 
-	ctx->buffer->i = p - ctx->buffer->p;
+	b_set_data(ctx->buffer, p - b_head(ctx->buffer));
 	ctx->flags |= SPOE_CTX_FL_FRAGMENTED;
 	ctx->frag_ctx.flags &= ~SPOE_FRM_FL_FIN;
 	return 1;
@@ -2445,8 +2445,8 @@
 	char *p, *end;
 	int   ret;
 
-	p   = ctx->buffer->p;
-	end = p + ctx->buffer->i;
+	p   = b_head(ctx->buffer);
+	end = p + b_data(ctx->buffer);
 
 	while (p < end)  {
 		enum spoe_action_type type;