packet.h #1

  • //
  • guest/
  • sandy_currier/
  • p4filter/
  • packet.h
  • View
  • Commits
  • Open Download .zip Download (777 B)
/*
 * packet.h: Perforce protocol data packets
 * $Header$
 */

#ifndef __PACKET_H
#define __PACKET_H

#include <sys/types.h> /* For size_t */

/* A "packet" is just a structure with a length and some amount of data.
 * The data part of the packet is just the actual content of the packet.
 * In the network world, a packet is a one-byte checksum, a four-byte
 * little-endian packet length, followed by the data. */
typedef struct packet
{
  size_t len;
  void *data;
} packet;

/* Given the length, create a new packet. */
packet *new_packet(size_t len);

/* Destroy a packet. */
void free_packet(packet *p);

/* Turn a packet into something suitable to send over the network.  Free
 * the result when done. */
void *packet_to_blob(const packet *p);

#endif /* __PACKET_H */
# Change User Description Committed
#1 450 sandy_currier Initial import of p4filter code.
 This contains a solaris2.6 binary but
no others.