/* * protocol.h: Deal with the Perforce protocol. * $Header$ */ #ifndef __PROTOCOL_H #define __PROTOCOL_H /* * PROTOCOL FORMAT * * The client and the server both speak mostly the same language. * Each sends to the other a series of packets with a number of * key/value pairs. A packet contains a single check byte, followed * by a four-byte length, followed by the data. The check byte is the * XOR of the length bytes; the length is little-endian, and specifies * the length of the data. (Thus, the packet is (length+5) bytes * long.) * * A packet consists of an integral number of key/value pairs. Each * pair consists of a null-terminated plain-text key. The null is * followed by a four-byte little-endian length. This word is * followed by data of exactly that many bytes, followed by another * null. */ #include "packet.h" #include "pair.h" /* Information we need to know to run the protocol. */ struct protocol_data { /* Standard input and output of the client... */ int client_in; int client_out; /* ...and of the server. */ int server_in; int server_out; /* The authorized user's name. */ const char *user; }; /* Given a valid setup, speak the Perforce protocol to the client and * the server. */ void do_protocol(struct protocol_data *setup); /* Convert packets to/from pairs. */ pair *packet_to_pair(const packet *data); packet *pair_to_packet(const pair *pair); /* Pull packets off the network, or push packets on. The data packet * will include the entire packet, including the five-byte packet header. */ packet *read_packet(int fd); int write_packet(int fd, const packet *data); #endif /* __PROTOCOL_H */
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 450 | sandy_currier |
Initial import of p4filter code. This contains a solaris2.6 binary but no others. |