MCPcopy Create free account
hub / github.com/ceph/ceph / decode_message

Function decode_message

src/msg/Message.cc:317–1024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315}
316
317Message *decode_message(CephContext *cct,
318 int crcflags,
319 ceph_msg_header& header,
320 ceph_msg_footer& footer,
321 ceph::bufferlist& front,
322 ceph::bufferlist& middle,
323 ceph::bufferlist& data,
324 Message::ConnectionRef conn)
325{
326#ifdef WITH_CRIMSON
327 // In crimson, conn is independently maintained outside Message.
328 ceph_assert(conn == nullptr);
329#endif
330 // verify crc
331 if (crcflags & MSG_CRC_HEADER) {
332 __u32 front_crc = front.crc32c(0);
333 __u32 middle_crc = middle.crc32c(0);
334
335 if (front_crc != footer.front_crc) {
336 if (cct) {
337 ldout(cct, 0) << "bad crc in front " << front_crc << " != exp " << footer.front_crc
338#ifndef WITH_CRIMSON
339 << " from " << conn->get_peer_addr()
340#endif
341 << dendl;
342 ldout(cct, 20) << " ";
343 front.hexdump(*_dout);
344 *_dout << dendl;
345 }
346 return 0;
347 }
348 if (middle_crc != footer.middle_crc) {
349 if (cct) {
350 ldout(cct, 0) << "bad crc in middle " << middle_crc << " != exp " << footer.middle_crc
351#ifndef WITH_CRIMSON
352 << " from " << conn->get_peer_addr()
353#endif
354 << dendl;
355 ldout(cct, 20) << " ";
356 middle.hexdump(*_dout);
357 *_dout << dendl;
358 }
359 return 0;
360 }
361 }
362 if (crcflags & MSG_CRC_DATA) {
363 if ((footer.flags & CEPH_MSG_FOOTER_NOCRC) == 0) {
364 __u32 data_crc = data.crc32c(0);
365 if (data_crc != footer.data_crc) {
366 if (cct) {
367 ldout(cct, 0) << "bad crc in data " << data_crc << " != exp " << footer.data_crc
368#ifndef WITH_CRIMSON
369 << " from " << conn->get_peer_addr()
370#endif
371 << dendl;
372 ldout(cct, 20) << " ";
373 data.hexdump(*_dout);
374 *_dout << dendl;

Callers 8

decodeMethod · 0.85
send_messageMethod · 0.85
handle_messageMethod · 0.85
handle_message_footerMethod · 0.85
decode_payloadMethod · 0.85
decode_payloadMethod · 0.85
read_messageMethod · 0.85

Calls 15

need_dynamicFunction · 0.85
crc32cMethod · 0.80
hexdumpMethod · 0.80
set_footerMethod · 0.80
set_payloadMethod · 0.80
set_middleMethod · 0.80
get_payloadMethod · 0.80
decodeFunction · 0.70
get_peer_addrMethod · 0.45
set_cctMethod · 0.45
get_headerMethod · 0.45
set_connectionMethod · 0.45

Tested by 1

send_messageMethod · 0.68