From 0917a071b0d18235777e01fa3a98d10e4e5f9a24 Mon Sep 17 00:00:00 2001 From: AlexPeshkoff Date: Sat, 27 Mar 2021 18:03:02 +0300 Subject: [PATCH] Postfix for CORE-6525 according to Adriano's suggestion --- src/burp/canonical.cpp | 22 +++--- src/common/xdr.cpp | 52 +++++++------- src/remote/inet.cpp | 16 ++--- src/remote/os/win32/wnet.cpp | 20 +++--- src/remote/os/win32/xnet.cpp | 16 ++--- src/remote/proto_proto.h | 4 +- src/remote/protocol.cpp | 128 +++++++++++++++++------------------ src/remote/remot_proto.h | 7 +- src/remote/remote.cpp | 6 +- src/remote/remote.h | 4 +- 10 files changed, 136 insertions(+), 139 deletions(-) diff --git a/src/burp/canonical.cpp b/src/burp/canonical.cpp index b9ae38af4c..4f533050c6 100644 --- a/src/burp/canonical.cpp +++ b/src/burp/canonical.cpp @@ -59,11 +59,9 @@ struct BurpXdr : public xdr_t lstring* x_public; }; -typedef struct BurpXdr XDR; - -static bool_t expand_buffer(XDR*); -static int xdr_init(XDR*, lstring*, enum xdr_op); -static bool_t xdr_slice(XDR*, lstring*, /*USHORT,*/ const UCHAR*); +static bool_t expand_buffer(BurpXdr*); +static int xdr_init(BurpXdr*, lstring*, enum xdr_op); +static bool_t xdr_slice(BurpXdr*, lstring*, /*USHORT,*/ const UCHAR*); const unsigned increment = 1024; @@ -83,8 +81,8 @@ ULONG CAN_encode_decode(burp_rel* relation, lstring* buffer, UCHAR* data, bool d const burp_fld* field; SSHORT n; - XDR xdr; - XDR* xdrs = &xdr; + BurpXdr xdr; + BurpXdr* xdrs = &xdr; xdr_init(xdrs, buffer, direction ? XDR_ENCODE : XDR_DECODE); @@ -274,8 +272,8 @@ ULONG CAN_slice(lstring* buffer, lstring* slice, bool direction, UCHAR* sdl) * encode and decode canonical backup. * **************************************/ - XDR xdr; - XDR* xdrs = &xdr; + BurpXdr xdr; + BurpXdr* xdrs = &xdr; xdr_init(xdrs, buffer, direction ? XDR_ENCODE : XDR_DECODE); @@ -354,7 +352,7 @@ bool_t BurpXdr::x_putbytes(const SCHAR* buff, unsigned bytecount) } -static bool_t expand_buffer(XDR* xdrs) +static bool_t expand_buffer(BurpXdr* xdrs) { /************************************** * @@ -388,7 +386,7 @@ static bool_t expand_buffer(XDR* xdrs) } -static int xdr_init(XDR* xdrs, lstring* buffer, enum xdr_op x_op) +static int xdr_init(BurpXdr* xdrs, lstring* buffer, enum xdr_op x_op) { /************************************** * @@ -408,7 +406,7 @@ static int xdr_init(XDR* xdrs, lstring* buffer, enum xdr_op x_op) } -static bool_t xdr_slice(XDR* xdrs, lstring* slice, /*USHORT sdl_length,*/ const UCHAR* sdl) +static bool_t xdr_slice(BurpXdr* xdrs, lstring* slice, /*USHORT sdl_length,*/ const UCHAR* sdl) { /************************************** * diff --git a/src/common/xdr.cpp b/src/common/xdr.cpp index 826c76a1a6..8a1f54a6c2 100644 --- a/src/common/xdr.cpp +++ b/src/common/xdr.cpp @@ -33,7 +33,7 @@ #include "../common/DecFloat.h" #include "../common/Int128.h" -typedef struct xdr_t XDR; +typedef struct xdr_t xdr_t; inline UCHAR* XDR_ALLOC(ULONG size) { @@ -45,19 +45,19 @@ inline void XDR_FREEA(void* block) } #ifdef DEBUG_XDR_MEMORY -inline void DEBUG_XDR_ALLOC(XDR* xdrs, const void* xdrvar, const void* addr, ULONG len) +inline void DEBUG_XDR_ALLOC(xdr_t* xdrs, const void* xdrvar, const void* addr, ULONG len) { xdr_debug_memory(xdrs, XDR_DECODE, xdrvar, addr, len) } -inline void DEBUG_XDR_FREE(XDR* xdrs, const void* xdrvar, const void* addr, ULONG len) +inline void DEBUG_XDR_FREE(xdr_t* xdrs, const void* xdrvar, const void* addr, ULONG len) { xdr_debug_memory (xdrs, XDR_FREE, xdrvar, addr, (ULONG) len); } #else -inline void DEBUG_XDR_ALLOC(XDR*, const void*, const void*, ULONG) +inline void DEBUG_XDR_ALLOC(xdr_t*, const void*, const void*, ULONG) { } -inline void DEBUG_XDR_FREE(XDR*, const void*, const void*, ULONG) +inline void DEBUG_XDR_FREE(xdr_t*, const void*, const void*, ULONG) { } #endif // DEBUG_XDR_MEMORY @@ -73,7 +73,7 @@ const unsigned MAXSTRING_FOR_WRAPSTRING = 65535; #define GETBYTES xdrs->x_getbytes #define PUTBYTES xdrs->x_putbytes -inline bool_t GETLONG(XDR* xdrs, SLONG* lp) +inline bool_t GETLONG(xdr_t* xdrs, SLONG* lp) { SLONG l; @@ -85,7 +85,7 @@ inline bool_t GETLONG(XDR* xdrs, SLONG* lp) return TRUE; } -inline bool_t PUTLONG(XDR* xdrs, const SLONG* lp) +inline bool_t PUTLONG(xdr_t* xdrs, const SLONG* lp) { const SLONG l = xdrs->x_local ? *lp : htonl(*lp); return xdrs->x_putbytes(reinterpret_cast(&l), 4); @@ -94,7 +94,7 @@ inline bool_t PUTLONG(XDR* xdrs, const SLONG* lp) static SCHAR zeros[4] = { 0, 0, 0, 0 }; -bool_t xdr_hyper( XDR* xdrs, void* pi64) +bool_t xdr_hyper( xdr_t* xdrs, void* pi64) { /************************************** * @@ -155,7 +155,7 @@ bool_t xdr_hyper( XDR* xdrs, void* pi64) } -bool_t xdr_datum( XDR* xdrs, const dsc* desc, UCHAR* buffer) +bool_t xdr_datum( xdr_t* xdrs, const dsc* desc, UCHAR* buffer) { /************************************** * @@ -335,7 +335,7 @@ bool_t xdr_datum( XDR* xdrs, const dsc* desc, UCHAR* buffer) } -bool_t xdr_double(XDR* xdrs, double* ip) +bool_t xdr_double(xdr_t* xdrs, double* ip) { /************************************** * @@ -382,13 +382,13 @@ bool_t xdr_double(XDR* xdrs, double* ip) } -bool_t xdr_dec64(XDR* xdrs, Firebird::Decimal64* ip) +bool_t xdr_dec64(xdr_t* xdrs, Firebird::Decimal64* ip) { return xdr_hyper(xdrs, ip->getBytes()); } -bool_t xdr_dec128(XDR* xdrs, Firebird::Decimal128* ip) +bool_t xdr_dec128(xdr_t* xdrs, Firebird::Decimal128* ip) { UCHAR* bytes = ip->getBytes(); @@ -401,7 +401,7 @@ bool_t xdr_dec128(XDR* xdrs, Firebird::Decimal128* ip) } -bool_t xdr_int128(XDR* xdrs, Firebird::Int128* ip) +bool_t xdr_int128(xdr_t* xdrs, Firebird::Int128* ip) { UCHAR* bytes = ip->getBytes(); @@ -414,7 +414,7 @@ bool_t xdr_int128(XDR* xdrs, Firebird::Int128* ip) } -bool_t xdr_enum(XDR* xdrs, xdr_op* ip) +bool_t xdr_enum(xdr_t* xdrs, xdr_op* ip) { /************************************** * @@ -448,7 +448,7 @@ bool_t xdr_enum(XDR* xdrs, xdr_op* ip) } -bool_t xdr_float(XDR* xdrs, float* ip) +bool_t xdr_float(xdr_t* xdrs, float* ip) { /************************************** * @@ -478,7 +478,7 @@ bool_t xdr_float(XDR* xdrs, float* ip) } -bool_t xdr_int(XDR* xdrs, int* ip) +bool_t xdr_int(xdr_t* xdrs, int* ip) { /************************************** * @@ -512,7 +512,7 @@ bool_t xdr_int(XDR* xdrs, int* ip) } -bool_t xdr_long(XDR* xdrs, SLONG* ip) +bool_t xdr_long(xdr_t* xdrs, SLONG* ip) { /************************************** * @@ -541,7 +541,7 @@ bool_t xdr_long(XDR* xdrs, SLONG* ip) } -bool_t xdr_opaque(XDR* xdrs, SCHAR* p, unsigned len) +bool_t xdr_opaque(xdr_t* xdrs, SCHAR* p, unsigned len) { /************************************** * @@ -582,7 +582,7 @@ bool_t xdr_opaque(XDR* xdrs, SCHAR* p, unsigned len) } -bool_t xdr_quad( XDR* xdrs, SQUAD* ip) +bool_t xdr_quad( xdr_t* xdrs, SQUAD* ip) { /************************************** * @@ -622,7 +622,7 @@ bool_t xdr_quad( XDR* xdrs, SQUAD* ip) } -bool_t xdr_short(XDR* xdrs, SSHORT* ip) +bool_t xdr_short(xdr_t* xdrs, SSHORT* ip) { /************************************** * @@ -656,7 +656,7 @@ bool_t xdr_short(XDR* xdrs, SSHORT* ip) } -bool_t xdr_string(XDR* xdrs, SCHAR** sp, unsigned maxlength) +bool_t xdr_string(xdr_t* xdrs, SCHAR** sp, unsigned maxlength) { /************************************** * @@ -719,7 +719,7 @@ bool_t xdr_string(XDR* xdrs, SCHAR** sp, unsigned maxlength) } -bool_t xdr_u_int(XDR* xdrs, unsigned* ip) +bool_t xdr_u_int(xdr_t* xdrs, unsigned* ip) { /************************************** * @@ -754,7 +754,7 @@ bool_t xdr_u_int(XDR* xdrs, unsigned* ip) } -bool_t xdr_u_long(XDR* xdrs, ULONG* ip) +bool_t xdr_u_long(xdr_t* xdrs, ULONG* ip) { /************************************** * @@ -785,7 +785,7 @@ bool_t xdr_u_long(XDR* xdrs, ULONG* ip) } -bool_t xdr_u_short(XDR* xdrs, u_short* ip) +bool_t xdr_u_short(xdr_t* xdrs, u_short* ip) { /************************************** * @@ -819,7 +819,7 @@ bool_t xdr_u_short(XDR* xdrs, u_short* ip) } -bool_t xdr_wrapstring(XDR* xdrs, SCHAR** strp) +bool_t xdr_wrapstring(xdr_t* xdrs, SCHAR** strp) { /************************************** * @@ -882,7 +882,7 @@ bool_t xdr_t::x_getbytes(SCHAR* buff, unsigned bytecount) } -SLONG xdr_peek_long(const XDR* xdrs, const void* data, size_t size) +SLONG xdr_peek_long(const xdr_t* xdrs, const void* data, size_t size) { /************************************** * diff --git a/src/remote/inet.cpp b/src/remote/inet.cpp index 52e2fc8ddd..43b6f68123 100644 --- a/src/remote/inet.cpp +++ b/src/remote/inet.cpp @@ -543,7 +543,7 @@ static void get_peer_info(rem_port*); static void inet_gen_error(bool, rem_port*, const Arg::StatusVector& v); static void inet_error(bool, rem_port*, const TEXT*, ISC_STATUS, int); -static bool inet_read(XDR*); +static bool inet_read(RemoteXdr*); static rem_port* inet_try_connect( PACKET*, Rdb*, const PathName&, @@ -552,7 +552,7 @@ static rem_port* inet_try_connect( PACKET*, RefPtr*, const PathName*, int); -static bool inet_write(XDR*); +static bool inet_write(RemoteXdr*); static rem_port* listener_socket(rem_port* port, USHORT flag, const addrinfo* pai); #ifdef DEBUG @@ -571,7 +571,7 @@ static bool select_wait(rem_port*, Select*); static int send_full(rem_port*, PACKET *); static int send_partial(rem_port*, PACKET *); -static XDR* xdrinet_create(rem_port*, UCHAR *, USHORT, enum xdr_op); +static RemoteXdr* xdrinet_create(rem_port*, UCHAR *, USHORT, enum xdr_op); static bool setNoNagleOption(rem_port*); static bool setFastLoopbackOption(rem_port*, SOCKET s = INVALID_SOCKET); static bool setKeepAlive(SOCKET); @@ -579,7 +579,7 @@ static FPTR_INT tryStopMainThread = 0; -struct InetXdr : public XDR +struct InetXdr : public RemoteXdr { virtual bool_t x_getbytes(SCHAR *, unsigned); // get some bytes from " virtual bool_t x_putbytes(const SCHAR*, unsigned); // put some bytes to " @@ -2469,7 +2469,7 @@ static int send_partial( rem_port* port, PACKET * packet) } -XDR* xdrinet_create(rem_port* port, UCHAR* buffer, USHORT length, enum xdr_op x_op) +RemoteXdr* xdrinet_create(rem_port* port, UCHAR* buffer, USHORT length, enum xdr_op x_op) { /************************************** * @@ -2482,7 +2482,7 @@ XDR* xdrinet_create(rem_port* port, UCHAR* buffer, USHORT length, enum xdr_op x_ * **************************************/ - XDR* xdrs = FB_NEW InetXdr; + RemoteXdr* xdrs = FB_NEW InetXdr; xdrs->x_public = port; xdrs->create(reinterpret_cast(buffer), length, x_op); @@ -2763,7 +2763,7 @@ bool_t InetXdr::x_putbytes(const SCHAR* buff, unsigned bytecount) return TRUE; } -static bool inet_read( XDR* xdrs) +static bool inet_read( RemoteXdr* xdrs) { /************************************** * @@ -2887,7 +2887,7 @@ static rem_port* inet_try_connect(PACKET* packet, return port; } -static bool inet_write(XDR* xdrs) +static bool inet_write(RemoteXdr* xdrs) { /************************************** * diff --git a/src/remote/os/win32/wnet.cpp b/src/remote/os/win32/wnet.cpp index f72d0c9634..104314abb3 100644 --- a/src/remote/os/win32/wnet.cpp +++ b/src/remote/os/win32/wnet.cpp @@ -76,12 +76,12 @@ static rem_str* make_pipe_name(const RefPtr&, const TEXT*, const static rem_port* receive(rem_port*, PACKET*); static int send_full(rem_port*, PACKET*); static int send_partial(rem_port*, PACKET*); -static XDR* xdrwnet_create(rem_port*, UCHAR *, USHORT, xdr_op); -static bool_t xdrwnet_endofrecord(XDR*);//, int); +static RemoteXdr* xdrwnet_create(rem_port*, UCHAR *, USHORT, xdr_op); +static bool_t xdrwnet_endofrecord(RemoteXdr*);//, int); static bool wnet_error(rem_port*, const TEXT*, ISC_STATUS, int); static void wnet_gen_error(rem_port*, const Arg::StatusVector& v); -static bool_t wnet_read(XDR*); -static bool_t wnet_write(XDR*); //, int); +static bool_t wnet_read(RemoteXdr*); +static bool_t wnet_write(RemoteXdr*); //, int); #ifdef DEBUG static void packet_print(const TEXT*, const UCHAR*, const int); #endif @@ -91,7 +91,7 @@ static void wnet_make_file_name(TEXT*, DWORD); static int cleanup_ports(const int, const int, void*); -struct WnetXdr : public XDR +struct WnetXdr : public RemoteXdr { virtual bool_t x_getbytes(SCHAR *, unsigned); // get some bytes from " virtual bool_t x_putbytes(const SCHAR*, unsigned); // put some bytes to " @@ -932,7 +932,7 @@ static int send_partial( rem_port* port, PACKET* packet) } -static XDR* xdrwnet_create(rem_port* port, UCHAR* buffer, USHORT length, xdr_op x_op) +static RemoteXdr* xdrwnet_create(rem_port* port, UCHAR* buffer, USHORT length, xdr_op x_op) { /************************************** * @@ -945,7 +945,7 @@ static XDR* xdrwnet_create(rem_port* port, UCHAR* buffer, USHORT length, xdr_op * **************************************/ - XDR* xdrs = FB_NEW WnetXdr; + RemoteXdr* xdrs = FB_NEW WnetXdr; xdrs->x_public = port; xdrs->create(reinterpret_cast(buffer), length, x_op); @@ -954,7 +954,7 @@ static XDR* xdrwnet_create(rem_port* port, UCHAR* buffer, USHORT length, xdr_op } -static bool_t xdrwnet_endofrecord( XDR* xdrs) //, bool_t flushnow) +static bool_t xdrwnet_endofrecord( RemoteXdr* xdrs) //, bool_t flushnow) { /************************************** * @@ -1165,7 +1165,7 @@ bool_t WnetXdr::x_putbytes(const SCHAR* buff, unsigned count) } -static bool_t wnet_read( XDR* xdrs) +static bool_t wnet_read( RemoteXdr* xdrs) { /************************************** * @@ -1216,7 +1216,7 @@ static bool_t wnet_read( XDR* xdrs) } -static bool_t wnet_write( XDR* xdrs /*, bool_t end_flag*/) +static bool_t wnet_write( RemoteXdr* xdrs /*, bool_t end_flag*/) { /************************************** * diff --git a/src/remote/os/win32/xnet.cpp b/src/remote/os/win32/xnet.cpp index 55943da14c..e4e561b56f 100644 --- a/src/remote/os/win32/xnet.cpp +++ b/src/remote/os/win32/xnet.cpp @@ -68,12 +68,12 @@ static rem_port* receive(rem_port*, PACKET*); static int send_full(rem_port*, PACKET*); static int send_partial(rem_port*, PACKET*); -static XDR* xdrxnet_create(rem_port*, UCHAR *, USHORT, xdr_op); +static RemoteXdr* xdrxnet_create(rem_port*, UCHAR *, USHORT, xdr_op); -static bool_t xnet_read(XDR* xdrs); -static bool_t xnet_write(XDR* xdrs); +static bool_t xnet_read(RemoteXdr* xdrs); +static bool_t xnet_write(RemoteXdr* xdrs); -struct XnetXdr : public XDR +struct XnetXdr : public RemoteXdr { virtual bool_t x_getbytes(SCHAR *, unsigned); // get some bytes from " virtual bool_t x_putbytes(const SCHAR*, unsigned); // put some bytes to " @@ -1691,7 +1691,7 @@ void XnetClientEndPoint::server_shutdown(rem_port* port) } -static XDR* xdrxnet_create(rem_port* port, UCHAR* buffer, USHORT length, xdr_op x_op) +static RemoteXdr* xdrxnet_create(rem_port* port, UCHAR* buffer, USHORT length, xdr_op x_op) { /************************************** * @@ -1704,7 +1704,7 @@ static XDR* xdrxnet_create(rem_port* port, UCHAR* buffer, USHORT length, xdr_op * **************************************/ - XDR* xdrs = FB_NEW XnetXdr; + RemoteXdr* xdrs = FB_NEW XnetXdr; xdrs->x_public = port; xdrs->create(reinterpret_cast(buffer), length, x_op); @@ -1938,7 +1938,7 @@ bool_t XnetXdr::x_putbytes(const SCHAR* buff, unsigned bytecount) } -static bool_t xnet_read(XDR* xdrs) +static bool_t xnet_read(RemoteXdr* xdrs) { /************************************** * @@ -2025,7 +2025,7 @@ static bool_t xnet_read(XDR* xdrs) } -static bool_t xnet_write(XDR* xdrs) +static bool_t xnet_write(RemoteXdr* xdrs) { /************************************** * diff --git a/src/remote/proto_proto.h b/src/remote/proto_proto.h index ad63c917ab..cb31ae8a00 100644 --- a/src/remote/proto_proto.h +++ b/src/remote/proto_proto.h @@ -25,9 +25,9 @@ #define REMOTE_PROTO_PROTO_H #ifdef DEBUG_XDR_MEMORY -void xdr_debug_memory (XDR*, enum xdr_op, const void*, const void*, ULONG); +void xdr_debug_memory (RemoteXdr*, enum xdr_op, const void*, const void*, ULONG); #endif -bool_t xdr_protocol (XDR*, struct packet*); +bool_t xdr_protocol (RemoteXdr*, struct packet*); ULONG xdr_protocol_overhead (P_OP); #endif // REMOTE_PROTO_PROTO_H diff --git a/src/remote/protocol.cpp b/src/remote/protocol.cpp index cd96f48660..754f63b495 100644 --- a/src/remote/protocol.cpp +++ b/src/remote/protocol.cpp @@ -48,42 +48,42 @@ using namespace Firebird; #ifdef DEBUG_XDR_MEMORY -inline bool_t P_TRUE(XDR* xdrs, PACKET* p) +inline bool_t P_TRUE(RemoteXdr* xdrs, PACKET* p) { return xdr_debug_packet(xdrs, XDR_FREE, p); } -inline bool_t P_FALSE(XDR* xdrs, PACKET* p) +inline bool_t P_FALSE(RemoteXdr* xdrs, PACKET* p) { return !xdr_debug_packet(xdrs, XDR_FREE, p); } -inline void DEBUG_XDR_PACKET(XDR* xdrs, PACKET* p) +inline void DEBUG_XDR_PACKET(RemoteXdr* xdrs, PACKET* p) { xdr_debug_packet(xdrs, XDR_DECODE, p); } -inline void DEBUG_XDR_ALLOC(XDR* xdrs, const void* xdrvar, const void* addr, ULONG len) +inline void DEBUG_XDR_ALLOC(RemoteXdr* xdrs, const void* xdrvar, const void* addr, ULONG len) { xdr_debug_memory(xdrs, XDR_DECODE, xdrvar, addr, len); } -inline void DEBUG_XDR_FREE(XDR* xdrs, const void* xdrvar, const void* addr, ULONG len) +inline void DEBUG_XDR_FREE(RemoteXdr* xdrs, const void* xdrvar, const void* addr, ULONG len) { xdr_debug_memory(xdrs, XDR_DECODE, xdrvar, addr, len); } #else -inline bool_t P_TRUE(XDR*, PACKET*) +inline bool_t P_TRUE(RemoteXdr*, PACKET*) { return TRUE; } -inline bool_t P_FALSE(XDR* xdrs, PACKET*) +inline bool_t P_FALSE(RemoteXdr* xdrs, PACKET*) { return FALSE; } -inline void DEBUG_XDR_PACKET(XDR*, PACKET*) +inline void DEBUG_XDR_PACKET(RemoteXdr*, PACKET*) { } -inline void DEBUG_XDR_ALLOC(XDR*, const void*, const void*, ULONG) +inline void DEBUG_XDR_ALLOC(RemoteXdr*, const void*, const void*, ULONG) { } -inline void DEBUG_XDR_FREE(XDR*, const void*, const void*, ULONG) +inline void DEBUG_XDR_FREE(RemoteXdr*, const void*, const void*, ULONG) { } #endif // DEBUG_XDR_MEMORY @@ -99,32 +99,32 @@ enum SQL_STMT_TYPE TYPE_PREPARED }; -static bool alloc_cstring(XDR*, CSTRING*); -static void free_cstring(XDR*, CSTRING*); -static void reset_statement(XDR*, SSHORT); -static bool_t xdr_cstring(XDR*, CSTRING*); -static bool_t xdr_response(XDR*, CSTRING*); -static bool_t xdr_cstring_with_limit(XDR*, CSTRING*, ULONG); -static inline bool_t xdr_cstring_const(XDR*, CSTRING_CONST*); +static bool alloc_cstring(RemoteXdr*, CSTRING*); +static void free_cstring(RemoteXdr*, CSTRING*); +static void reset_statement(RemoteXdr*, SSHORT); +static bool_t xdr_cstring(RemoteXdr*, CSTRING*); +static bool_t xdr_response(RemoteXdr*, CSTRING*); +static bool_t xdr_cstring_with_limit(RemoteXdr*, CSTRING*, ULONG); +static inline bool_t xdr_cstring_const(RemoteXdr*, CSTRING_CONST*); #ifdef DEBUG_XDR_MEMORY -static bool_t xdr_debug_packet(XDR*, enum xdr_op, PACKET*); +static bool_t xdr_debug_packet(RemoteXdr*, enum xdr_op, PACKET*); #endif -static bool_t xdr_longs(XDR*, CSTRING*); -static bool_t xdr_message(XDR*, RMessage*, const rem_fmt*); -static bool_t xdr_packed_message(XDR*, RMessage*, const rem_fmt*); -static bool_t xdr_request(XDR*, USHORT, USHORT, USHORT); -static bool_t xdr_slice(XDR*, lstring*, /*USHORT,*/ const UCHAR*); -static bool_t xdr_status_vector(XDR*, DynamicStatusVector*&); -static bool_t xdr_sql_blr(XDR*, SLONG, CSTRING*, bool, SQL_STMT_TYPE); -static bool_t xdr_sql_message(XDR*, SLONG); -static bool_t xdr_trrq_blr(XDR*, CSTRING*); -static bool_t xdr_trrq_message(XDR*, USHORT); -static bool_t xdr_bytes(XDR*, void*, ULONG); -static bool_t xdr_blob_stream(XDR*, SSHORT, CSTRING*); -static Rsr* getStatement(XDR*, USHORT); +static bool_t xdr_longs(RemoteXdr*, CSTRING*); +static bool_t xdr_message(RemoteXdr*, RMessage*, const rem_fmt*); +static bool_t xdr_packed_message(RemoteXdr*, RMessage*, const rem_fmt*); +static bool_t xdr_request(RemoteXdr*, USHORT, USHORT, USHORT); +static bool_t xdr_slice(RemoteXdr*, lstring*, /*USHORT,*/ const UCHAR*); +static bool_t xdr_status_vector(RemoteXdr*, DynamicStatusVector*&); +static bool_t xdr_sql_blr(RemoteXdr*, SLONG, CSTRING*, bool, SQL_STMT_TYPE); +static bool_t xdr_sql_message(RemoteXdr*, SLONG); +static bool_t xdr_trrq_blr(RemoteXdr*, CSTRING*); +static bool_t xdr_trrq_message(RemoteXdr*, USHORT); +static bool_t xdr_bytes(RemoteXdr*, void*, ULONG); +static bool_t xdr_blob_stream(RemoteXdr*, SSHORT, CSTRING*); +static Rsr* getStatement(RemoteXdr*, USHORT); -inline void fixupLength(const XDR* xdrs, ULONG& length) +inline void fixupLength(const RemoteXdr* xdrs, ULONG& length) { // If the short (16-bit) value >= 32KB is being transmitted, // it gets expanded to long (32-bit) with a sign bit propagated. @@ -139,7 +139,7 @@ inline void fixupLength(const XDR* xdrs, ULONG& length) #ifdef DEBUG static ULONG xdr_save_size = 0; -inline void DEBUG_PRINTSIZE(XDR* xdrs, P_OP p) +inline void DEBUG_PRINTSIZE(RemoteXdr* xdrs, P_OP p) { fprintf (stderr, "xdr_protocol: %s op %d size %lu\n", ((xdrs->x_op == XDR_FREE) ? "free" : @@ -149,14 +149,14 @@ inline void DEBUG_PRINTSIZE(XDR* xdrs, P_OP p) (xdrs->x_handy - xdr_save_size) : (xdr_save_size - xdrs->x_handy))); } #else -inline void DEBUG_PRINTSIZE(XDR*, P_OP) +inline void DEBUG_PRINTSIZE(RemoteXdr*, P_OP) { } #endif #ifdef DEBUG_XDR_MEMORY -void xdr_debug_memory(XDR* xdrs, +void xdr_debug_memory(RemoteXdr* xdrs, enum xdr_op xop, const void* xdrvar, const void* address, ULONG length) { @@ -167,13 +167,13 @@ void xdr_debug_memory(XDR* xdrs, ************************************** * * Functional description - * Track memory allocation patterns of XDR aggregate + * Track memory allocation patterns of RemoteXdr aggregate * types (i.e. xdr_cstring, xdr_string, etc.) to * validate that memory is not leaked by overwriting - * XDR aggregate pointers and that freeing a packet + * RemoteXdr aggregate pointers and that freeing a packet * with REMOTE_free_packet() does not miss anything. * - * All memory allocations due to marshalling XDR + * All memory allocations due to marshalling RemoteXdr * variables are recorded in a debug memory alloca- * tion table stored at the front of a packet. * @@ -183,7 +183,7 @@ void xdr_debug_memory(XDR* xdrs, * allocation being freed cannot be found. At most * P_MALLOC_SIZE entries can be stored in the memory * allocation table. A rough estimate of the number - * of XDR aggregates that can hang off a packet can + * of RemoteXdr aggregates that can hang off a packet can * be obtained by examining the subpackets defined * in : A guestimate of 36 at this * time includes 10 strings used to decode an xdr @@ -194,7 +194,7 @@ void xdr_debug_memory(XDR* xdrs, fb_assert(port != 0); fb_assert(port->port_header.blk_type == type_port); - // Compare the XDR variable address with the lower and upper bounds + // Compare the RemoteXdr variable address with the lower and upper bounds // of each packet to determine which packet contains it. Record or // delete an entry in that packet's memory allocation table. @@ -251,7 +251,7 @@ void xdr_debug_memory(XDR* xdrs, #endif -bool_t xdr_protocol(XDR* xdrs, PACKET* p) +bool_t xdr_protocol(RemoteXdr* xdrs, PACKET* p) { /************************************** * @@ -1127,7 +1127,7 @@ bool_t xdr_protocol(XDR* xdrs, PACKET* p) } -static bool_t xdr_bytes(XDR* xdrs, void* bytes, ULONG size) +static bool_t xdr_bytes(RemoteXdr* xdrs, void* bytes, ULONG size) { switch (xdrs->x_op) { @@ -1204,7 +1204,7 @@ ULONG xdr_protocol_overhead(P_OP op) } -static bool alloc_cstring(XDR* xdrs, CSTRING* cstring) +static bool alloc_cstring(RemoteXdr* xdrs, CSTRING* cstring) { /************************************** * @@ -1250,7 +1250,7 @@ static bool alloc_cstring(XDR* xdrs, CSTRING* cstring) } -static void free_cstring( XDR* xdrs, CSTRING* cstring) +static void free_cstring( RemoteXdr* xdrs, CSTRING* cstring) { /************************************** * @@ -1274,7 +1274,7 @@ static void free_cstring( XDR* xdrs, CSTRING* cstring) } -static bool xdr_is_client(XDR* xdrs) +static bool xdr_is_client(RemoteXdr* xdrs) { const rem_port* port = xdrs->x_public; return !(port->port_flags & PORT_server); @@ -1291,7 +1291,7 @@ static bool xdr_is_client(XDR* xdrs) // Changing CSTRING to use cstr_address as const pointer would upset other // places of the code, so only P_BLOB was changed to use CSTRING_CONST. // The same function is being used to check P_SGMT & P_DDL. -static inline bool_t xdr_cstring_const(XDR* xdrs, CSTRING_CONST* cstring) +static inline bool_t xdr_cstring_const(RemoteXdr* xdrs, CSTRING_CONST* cstring) { if (xdr_is_client(xdrs) && xdrs->x_op == XDR_DECODE) { @@ -1308,7 +1308,7 @@ static inline bool_t xdr_cstring_const(XDR* xdrs, CSTRING_CONST* cstring) return xdr_cstring(xdrs, reinterpret_cast(cstring)); } -static inline bool_t xdr_response(XDR* xdrs, CSTRING* cstring) +static inline bool_t xdr_response(RemoteXdr* xdrs, CSTRING* cstring) { if (xdr_is_client(xdrs) && xdrs->x_op == XDR_DECODE && cstring->cstr_allocated) { @@ -1320,12 +1320,12 @@ static inline bool_t xdr_response(XDR* xdrs, CSTRING* cstring) return xdr_cstring(xdrs, cstring); } -static bool_t xdr_cstring( XDR* xdrs, CSTRING* cstring) +static bool_t xdr_cstring( RemoteXdr* xdrs, CSTRING* cstring) { return xdr_cstring_with_limit(xdrs, cstring, 0); } -static bool_t xdr_cstring_with_limit( XDR* xdrs, CSTRING* cstring, ULONG limit) +static bool_t xdr_cstring_with_limit( RemoteXdr* xdrs, CSTRING* cstring, ULONG limit) { /************************************** * @@ -1384,7 +1384,7 @@ static bool_t xdr_cstring_with_limit( XDR* xdrs, CSTRING* cstring, ULONG limit) #ifdef DEBUG_XDR_MEMORY -static bool_t xdr_debug_packet( XDR* xdrs, enum xdr_op xop, PACKET* packet) +static bool_t xdr_debug_packet( RemoteXdr* xdrs, enum xdr_op xop, PACKET* packet) { /************************************** * @@ -1451,7 +1451,7 @@ static bool_t xdr_debug_packet( XDR* xdrs, enum xdr_op xop, PACKET* packet) #endif -static bool_t xdr_longs( XDR* xdrs, CSTRING* cstring) +static bool_t xdr_longs( RemoteXdr* xdrs, CSTRING* cstring) { /************************************** * @@ -1501,7 +1501,7 @@ static bool_t xdr_longs( XDR* xdrs, CSTRING* cstring) } -static bool_t xdr_message( XDR* xdrs, RMessage* message, const rem_fmt* format) +static bool_t xdr_message( RemoteXdr* xdrs, RMessage* message, const rem_fmt* format) { /************************************** * @@ -1539,7 +1539,7 @@ static bool_t xdr_message( XDR* xdrs, RMessage* message, const rem_fmt* format) } -static bool_t xdr_packed_message( XDR* xdrs, RMessage* message, const rem_fmt* format) +static bool_t xdr_packed_message( RemoteXdr* xdrs, RMessage* message, const rem_fmt* format) { /************************************** * @@ -1673,7 +1673,7 @@ static bool_t xdr_packed_message( XDR* xdrs, RMessage* message, const rem_fmt* f } -static bool_t xdr_request(XDR* xdrs, +static bool_t xdr_request(RemoteXdr* xdrs, USHORT request_id, USHORT message_number, USHORT incarnation) { @@ -1731,7 +1731,7 @@ static bool_t xdr_request(XDR* xdrs, // Maybe it's better to take sdl_length into account? -static bool_t xdr_slice(XDR* xdrs, lstring* slice, /*USHORT sdl_length,*/ const UCHAR* sdl) +static bool_t xdr_slice(RemoteXdr* xdrs, lstring* slice, /*USHORT sdl_length,*/ const UCHAR* sdl) { /************************************** * @@ -1826,7 +1826,7 @@ static bool_t xdr_slice(XDR* xdrs, lstring* slice, /*USHORT sdl_length,*/ const } -static bool_t xdr_sql_blr(XDR* xdrs, +static bool_t xdr_sql_blr(RemoteXdr* xdrs, SLONG statement_id, CSTRING* blr, bool direction, SQL_STMT_TYPE stmt_type) @@ -1934,7 +1934,7 @@ static bool_t xdr_sql_blr(XDR* xdrs, } -static bool_t xdr_sql_message( XDR* xdrs, SLONG statement_id) +static bool_t xdr_sql_message( RemoteXdr* xdrs, SLONG statement_id) { /************************************** * @@ -1989,7 +1989,7 @@ static bool_t xdr_sql_message( XDR* xdrs, SLONG statement_id) } -static bool_t xdr_status_vector(XDR* xdrs, DynamicStatusVector*& vector) +static bool_t xdr_status_vector(RemoteXdr* xdrs, DynamicStatusVector*& vector) { /************************************** * @@ -2080,7 +2080,7 @@ brk: while (space.hasData()) { SCHAR* sp = space.pop(); - XDR freeXdrs; + RemoteXdr freeXdrs; freeXdrs.x_public = xdrs->x_public; freeXdrs.x_op = XDR_FREE; if (!xdr_wrapstring(&freeXdrs, &sp)) @@ -2094,7 +2094,7 @@ brk: } -static bool_t xdr_trrq_blr(XDR* xdrs, CSTRING* blr) +static bool_t xdr_trrq_blr(RemoteXdr* xdrs, CSTRING* blr) { /************************************** * @@ -2164,7 +2164,7 @@ static bool_t xdr_trrq_blr(XDR* xdrs, CSTRING* blr) } -static bool_t xdr_trrq_message( XDR* xdrs, USHORT msg_type) +static bool_t xdr_trrq_message( RemoteXdr* xdrs, USHORT msg_type) { /************************************** * @@ -2189,7 +2189,7 @@ static bool_t xdr_trrq_message( XDR* xdrs, USHORT msg_type) } -static void reset_statement( XDR* xdrs, SSHORT statement_id) +static void reset_statement( RemoteXdr* xdrs, SSHORT statement_id) { /************************************** * @@ -2227,7 +2227,7 @@ static void reset_statement( XDR* xdrs, SSHORT statement_id) } } -static Rsr* getStatement(XDR* xdrs, USHORT statement_id) +static Rsr* getStatement(RemoteXdr* xdrs, USHORT statement_id) { rem_port* port = xdrs->x_public; @@ -2249,7 +2249,7 @@ static Rsr* getStatement(XDR* xdrs, USHORT statement_id) return port->port_statement; } -static bool_t xdr_blob_stream(XDR* xdrs, SSHORT statement_id, CSTRING* strmPortion) +static bool_t xdr_blob_stream(RemoteXdr* xdrs, SSHORT statement_id, CSTRING* strmPortion) { if (xdrs->x_op == XDR_FREE) return xdr_cstring(xdrs, strmPortion); diff --git a/src/remote/remot_proto.h b/src/remote/remot_proto.h index cb5679d0cf..4076158cb4 100644 --- a/src/remote/remot_proto.h +++ b/src/remote/remot_proto.h @@ -46,13 +46,12 @@ struct RemoteXdr : public xdr_t rem_port* x_public; }; -typedef struct RemoteXdr XDR; struct rem_fmt; struct Rdb; typedef bool PacketReceive(rem_port*, UCHAR*, SSHORT, SSHORT*); typedef bool PacketSend(rem_port*, const SCHAR*, SSHORT); -typedef bool ProtoWrite(XDR*); +typedef bool ProtoWrite(RemoteXdr*); enum LegacyPlugin {PLUGIN_NEW = 0, PLUGIN_LEGACY, PLUGIN_TRUSTED}; void REMOTE_cleanup_transaction (struct Rtr *); @@ -65,13 +64,13 @@ void REMOTE_release_messages (struct RMessage*); void REMOTE_release_request (struct Rrq *); void REMOTE_reset_request (struct Rrq *, struct RMessage*); void REMOTE_reset_statement (struct Rsr *); -bool_t REMOTE_getbytes (XDR*, SCHAR*, unsigned); +bool_t REMOTE_getbytes (RemoteXdr*, SCHAR*, unsigned); LegacyPlugin REMOTE_legacy_auth(const char* nm, int protocol); Firebird::RefPtr REMOTE_get_config(const Firebird::PathName* dbName, const Firebird::string* dpb_config = NULL); void REMOTE_check_response(Firebird::IStatus* warning, Rdb* rdb, PACKET* packet, bool checkKeys = false); bool REMOTE_inflate(rem_port*, PacketReceive*, UCHAR*, SSHORT, SSHORT*); -bool REMOTE_deflate(XDR*, ProtoWrite*, PacketSend*, bool flash); +bool REMOTE_deflate(RemoteXdr*, ProtoWrite*, PacketSend*, bool flash); extern signed char wcCompatible[3][3]; diff --git a/src/remote/remote.cpp b/src/remote/remote.cpp index f906de57cd..4e353455fa 100644 --- a/src/remote/remote.cpp +++ b/src/remote/remote.cpp @@ -318,7 +318,7 @@ void REMOTE_free_packet( rem_port* port, PACKET * packet, bool partial) * Zero out a full packet block (partial == false) or * part of packet used in last operation (partial == true) **************************************/ - XDR xdr; + RemoteXdr xdr; USHORT n; if (packet) @@ -707,7 +707,7 @@ void rem_port::auxAcceptError(PACKET* packet) } } -bool_t REMOTE_getbytes (XDR* xdrs, SCHAR* buff, unsigned bytecount) +bool_t REMOTE_getbytes (RemoteXdr* xdrs, SCHAR* buff, unsigned bytecount) { /************************************** * @@ -1459,7 +1459,7 @@ bool REMOTE_inflate(rem_port* port, PacketReceive* packet_receive, UCHAR* buffer #endif } -bool REMOTE_deflate(XDR* xdrs, ProtoWrite* proto_write, PacketSend* packet_send, bool flush) +bool REMOTE_deflate(RemoteXdr* xdrs, ProtoWrite* proto_write, PacketSend* packet_send, bool flush) { #ifdef WIRE_COMPRESS_SUPPORT rem_port* port = xdrs->x_public; diff --git a/src/remote/remote.h b/src/remote/remote.h index 8b0979128a..80aae17f88 100644 --- a/src/remote/remote.h +++ b/src/remote/remote.h @@ -1058,8 +1058,8 @@ struct rem_port : public Firebird::GlobalStorage, public Firebird::RefCounted HANDLE port_pipe; // port pipe handle HANDLE port_event; // event associated with a port #endif - Firebird::AutoPtr port_receive; - Firebird::AutoPtr port_send; + Firebird::AutoPtr port_receive; + Firebird::AutoPtr port_send; #ifdef DEBUG_XDR_MEMORY r e m _ v e c* port_packet_vector; // Vector of send/receive packets #endif