Imported Upstream version 2.6.0
[debian/amanda] / common-src / packet.h
index fb126261037e4319845a9b67c23977ad6ef12663..cc117f66eae2e4e93c1f0612bbae04319d76ae8a 100644 (file)
  * file named AUTHORS, in the root directory of this distribution.
  */
 /*
- * $Id: packet.h,v 1.6 2004/02/13 14:00:35 martinea Exp $
+ * $Id: packet.h,v 1.8 2006/05/25 01:47:12 johnfranks Exp $
  *
  * interfaces for modifying amanda protocol packet type
  */
 #ifndef PACKET_H
 #define PACKET_H
 
-/*
- * We limit our body length to 50k.
- */
-#define        MAX_PACKET      (50*1024)
-
 typedef enum { P_REQ = 0, P_REP = 1, P_PREP = 2, P_ACK = 3, P_NAK = 4 } pktype_t;
 typedef struct {
-    pktype_t type;                             /* type of packet */
-    char body[MAX_PACKET];                     /* body of packet */
+    pktype_t   type;                   /* type of packet */
+    char *     body;                   /* body of packet */
+    size_t     size;
+    size_t     packet_size;
 } pkt_t;
 
 /*
  * Initialize a packet
  */
-void pkt_init P((pkt_t *, pktype_t, const char *, ...))
-    __attribute__ ((format (printf, 3, 4)));
+void pkt_init_empty(pkt_t *pkt, pktype_t type);
+void pkt_init(pkt_t *, pktype_t, const char *, ...)
+     G_GNUC_PRINTF(3,4);
 
 /*
  * Append data to a packet
  */
-void pkt_cat P((pkt_t *, const char *, ...))
-    __attribute__ ((format (printf, 2, 3)));
+void pkt_cat(pkt_t *, const char *, ...)
+     G_GNUC_PRINTF(2,3);
 
 /*
  * Convert the packet type to and from a string
  */
-const char *pkt_type2str P((pktype_t));
-pktype_t pkt_str2type P((const char *));
+const char *pkt_type2str(pktype_t);
+pktype_t pkt_str2type(const char *);
 
 #endif /* PACKET_H */