X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=common-src%2Fpacket.h;h=cc117f66eae2e4e93c1f0612bbae04319d76ae8a;hb=94a044f90357edefa6f4ae9f0b1d5885b0e34aee;hp=fb126261037e4319845a9b67c23977ad6ef12663;hpb=1194fb66aa28d9929c3f2bef3cc6c1c3f40a60a4;p=debian%2Famanda diff --git a/common-src/packet.h b/common-src/packet.h index fb12626..cc117f6 100644 --- a/common-src/packet.h +++ b/common-src/packet.h @@ -24,40 +24,38 @@ * 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 */