text: // PostgreSQL Database Management System
  // (formerly known as Postgres, then as Postgres95)
  //
  // Portions Copyright (c) 1996-2010, The PostgreSQL Global Development Group
  //
  // Portions Copyright (c) 1994, The Regents of the University of California
  //
  // Permission to use, copy, modify, and distribute this software and its
  // documentation for any purpose, without fee, and without a written agreement
  // is hereby granted, provided that the above copyright notice and this
  // paragraph and the following two paragraphs appear in all copies.
  //
  // IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  // DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
  // LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
  // EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY
  // OF SUCH DAMAGE.
  //
  // THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  // AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
  // ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
  // TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  
  /*-------------------------------------------------------------------------
   *
   * pqformat.h
   *		Definitions for formatting and parsing frontend/backend messages
   *
   * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   * $PostgreSQL: pgsql/src/include/libpq/pqformat.h,v 1.29 2010/01/02 16:58:04 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
  #ifndef PQFORMAT_H
  #define PQFORMAT_H
  
  #include "lib/stringinfo.h"
  
  extern void pq_beginmessage(StringInfo buf, char msgtype);
  extern void pq_sendbyte(StringInfo buf, int byt);
  extern void pq_sendbytes(StringInfo buf, const char *data, int datalen);
  extern void pq_sendcountedtext(StringInfo buf, const char *str, int slen,
  				   bool countincludesself);
  extern void pq_sendtext(StringInfo buf, const char *str, int slen);
  extern void pq_sendstring(StringInfo buf, const char *str);
  extern void pq_send_ascii_string(StringInfo buf, const char *str);
  extern void pq_sendint(StringInfo buf, int i, int b);
  extern void pq_sendint64(StringInfo buf, int64 i);
  extern void pq_sendfloat4(StringInfo buf, float4 f);
  extern void pq_sendfloat8(StringInfo buf, float8 f);
  extern void pq_endmessage(StringInfo buf);
  
  extern void pq_begintypsend(StringInfo buf);
  extern bytea *pq_endtypsend(StringInfo buf);
  
  extern void pq_puttextmessage(char msgtype, const char *str);
  extern void pq_putemptymessage(char msgtype);
  
  extern int	pq_getmsgbyte(StringInfo msg);
  extern unsigned int pq_getmsgint(StringInfo msg, int b);
  extern int64 pq_getmsgint64(StringInfo msg);
  extern float4 pq_getmsgfloat4(StringInfo msg);
  extern float8 pq_getmsgfloat8(StringInfo msg);
  extern const char *pq_getmsgbytes(StringInfo msg, int datalen);
  extern void pq_copymsgbytes(StringInfo msg, char *buf, int datalen);
  extern char *pq_getmsgtext(StringInfo msg, int rawbytes, int *nbytes);
  extern const char *pq_getmsgstring(StringInfo msg);
  extern void pq_getmsgend(StringInfo msg);
  
  #endif   /* PQFORMAT_H */
  