1 /*------------------------------------------------------------------------- 2 * 3 * streamutil.h 4 * 5 * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group 6 * 7 * IDENTIFICATION 8 * src/bin/pg_basebackup/streamutil.h 9 *------------------------------------------------------------------------- 10 */ 11 12 #ifndef STREAMUTIL_H 13 #define STREAMUTIL_H 14 15 #include "libpq-fe.h" 16 17 #include "access/xlogdefs.h" 18 19 extern const char *progname; 20 extern char *connection_string; 21 extern char *dbhost; 22 extern char *dbuser; 23 extern char *dbport; 24 extern char *dbname; 25 extern int dbgetpassword; 26 extern char *replication_slot; 27 28 /* Connection kept global so we can disconnect easily */ 29 extern PGconn *conn; 30 31 extern PGconn *GetConnection(void); 32 33 /* Replication commands */ 34 extern bool CreateReplicationSlot(PGconn *conn, const char *slot_name, 35 const char *plugin, bool is_physical, 36 bool slot_exists_ok); 37 extern bool DropReplicationSlot(PGconn *conn, const char *slot_name); 38 extern bool RunIdentifySystem(PGconn *conn, char **sysid, 39 TimeLineID *starttli, 40 XLogRecPtr *startpos, 41 char **db_name); 42 extern int64 feGetCurrentTimestamp(void); 43 extern void feTimestampDifference(int64 start_time, int64 stop_time, 44 long *secs, int *microsecs); 45 46 extern bool feTimestampDifferenceExceeds(int64 start_time, int64 stop_time, 47 int msec); 48 extern void fe_sendint64(int64 i, char *buf); 49 extern int64 fe_recvint64(char *buf); 50 51 #endif /* STREAMUTIL_H */ 52