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

Function xdr_protocol_overhead

src/remote/protocol.cpp:1215–1270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1213
1214
1215ULONG xdr_protocol_overhead(P_OP op)
1216{
1217/**************************************
1218 *
1219 * x d r _ p r o t o c o l _ o v e r h e a d
1220 *
1221 **************************************
1222 *
1223 * Functional description
1224 * Report the overhead size of a particular packet.
1225 * NOTE: This is not the same as the actual size to
1226 * send the packet - as this figure discounts any data
1227 * to be sent with the packet. It's purpose is to figure
1228 * overhead for deciding on a batching window count.
1229 *
1230 * A better version of this routine would use xdr_sizeof - but
1231 * it is unknown how portable that Solaris call is to other
1232 * OS.
1233 *
1234 **************************************/
1235 ULONG size = 4; // xdr_sizeof (xdr_enum, p->p_operation)
1236
1237 switch (op)
1238 {
1239 case op_fetch_response:
1240 size += 4 // xdr_sizeof (xdr_long, sqldata->p_sqldata_status)
1241 + 4; // xdr_sizeof (xdr_short, sqldata->p_sqldata_messages)
1242 break;
1243
1244 case op_send:
1245 case op_start_and_send:
1246 case op_start_send_and_receive:
1247 size += 4 // xdr_sizeof (xdr_short, data->p_data_request)
1248 + 4 // xdr_sizeof (xdr_short, data->p_data_incarnation)
1249 + 4 // xdr_sizeof (xdr_short, data->p_data_transaction)
1250 + 4 // xdr_sizeof (xdr_short, data->p_data_message_number)
1251 + 4; // xdr_sizeof (xdr_short, data->p_data_messages)
1252 break;
1253
1254 case op_response:
1255 case op_response_piggyback:
1256 // Note: minimal amounts are used for cstring & status_vector
1257 size += 4 // xdr_sizeof (xdr_short, response->p_resp_object)
1258 + 8 // xdr_sizeof (xdr_quad, response->p_resp_blob_id)
1259 + 4 // xdr_sizeof (xdr_cstring, response->p_resp_data)
1260 +
1261 3 *
1262 4; // xdr_sizeof (xdr_status_vector (xdrs, response->p_resp_status_vector
1263 break;
1264
1265 default:
1266 fb_assert(FALSE); // Not supported operation
1267 return 0;
1268 }
1269 return size;
1270}
1271
1272

Callers 2

receive_after_startMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected