MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / xdr_packed_message

Function xdr_packed_message

src/remote/protocol.cpp:1609–1740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1607
1608
1609static bool_t xdr_packed_message( RemoteXdr* xdrs, RMessage* message, const rem_fmt* format)
1610{
1611/**************************************
1612 *
1613 * x d r _ p a c k e d _ m e s s a g e
1614 *
1615 **************************************
1616 *
1617 * Functional description
1618 * Map a formatted message.
1619 *
1620 **************************************/
1621
1622 if (xdrs->x_op == XDR_FREE)
1623 return TRUE;
1624
1625 const rem_port* const port = xdrs->x_public;
1626
1627 if (!message || !format)
1628 return FALSE;
1629
1630 // If we are running a symmetric version of the protocol, just slop
1631 // the bits and don't sweat the translations
1632
1633 if (port->port_flags & PORT_symmetric)
1634 return xdr_opaque(xdrs, reinterpret_cast<SCHAR*>(message->msg_address), format->fmt_length);
1635
1636 // Optimize the message by transforming NULL indicators into a bitmap
1637 // and then skipping the NULL items
1638
1639 class NullBitmap : private HalfStaticArray<UCHAR, 4>
1640 {
1641 public:
1642 explicit NullBitmap(USHORT size)
1643 {
1644 resize(size);
1645 }
1646
1647 void setNull(USHORT id)
1648 {
1649 data[id >> 3] |= (1 << (id & 7));
1650 }
1651
1652 bool isNull(USHORT id) const
1653 {
1654 return data[id >> 3] & (1 << (id & 7));
1655 }
1656
1657 UCHAR* getData()
1658 {
1659 return data;
1660 }
1661 };
1662
1663 fb_assert(format->fmt_desc.getCount() % 2 == 0);
1664 const USHORT flagBytes = (format->fmt_desc.getCount() / 2 + 7) / 8;
1665 NullBitmap nulls(flagBytes);
1666

Callers 2

xdr_protocolFunction · 0.85
xdr_sql_messageFunction · 0.85

Calls 9

xdr_opaqueFunction · 0.85
xdr_datumFunction · 0.85
DEBUG_PRINTSIZEFunction · 0.85
getCountMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
setNullMethod · 0.45
getDataMethod · 0.45
isNullMethod · 0.45

Tested by

no test coverage detected