1 //-------------------------------------------------------------------------- 2 // Copyright (C) 2019-2021 Cisco and/or its affiliates. All rights reserved. 3 // 4 // This program is free software; you can redistribute it and/or modify it 5 // under the terms of the GNU General Public License Version 2 as published 6 // by the Free Software Foundation. You may not use, modify or distribute 7 // this program under any other version of the GNU General Public License. 8 // 9 // This program is distributed in the hope that it will be useful, but 10 // WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 // General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License along 15 // with this program; if not, write to the Free Software Foundation, Inc., 16 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 //-------------------------------------------------------------------------- 18 // oops_handler.h author Michael Altizer <mialtize@cisco.com> 19 20 #ifndef OOPS_HANDLER_H 21 #define OOPS_HANDLER_H 22 23 #include <daq_common.h> 24 25 class OopsHandler 26 { 27 public: 28 static void handle_crash(int fd); 29 30 OopsHandler() = default; 31 ~OopsHandler() = default; 32 33 void tinit(); set_current_message(DAQ_Msg_h cm)34 void set_current_message(DAQ_Msg_h cm) { msg = cm; } 35 void tterm(); 36 37 private: 38 void eternalize(int fd); 39 40 private: 41 DAQ_Msg_h msg = nullptr; 42 // Eternalized data 43 DAQ_MsgType type = static_cast<DAQ_MsgType>(0); 44 uint8_t header[UINT16_MAX] = { }; 45 size_t header_len = 0; 46 uint8_t data[UINT16_MAX] = { }; 47 uint32_t data_len = 0; 48 }; 49 50 #endif 51 52