Program Listing for File raw_packet.hpp#

Return to documentation for file (python/morpheus/morpheus/_lib/include/morpheus/messages/raw_packet.hpp)

/*
 * SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <cstdint>
#include <memory>

namespace morpheus {

#pragma GCC visibility push(default)
/****** Component public implementations ******************/
/****** RawPacketMessage ****************************************/

class RawPacketMessage
{
  public:
    uint32_t count() const;

    uint32_t get_max_size() const;

    uintptr_t get_pkt_addr_idx(uint32_t pkt_idx) const;

    uintptr_t get_pkt_hdr_size_idx(uint32_t pkt_idx) const;

    uintptr_t get_pkt_pld_size_idx(uint32_t pkt_idx) const;

    uintptr_t* get_pkt_addr_list() const;

    uint32_t* get_pkt_hdr_size_list() const;

    uint32_t* get_pkt_pld_size_list() const;

    uint32_t get_queue_idx() const;

    bool is_gpu_mem() const;

    static std::shared_ptr<RawPacketMessage> create_from_cpp(uint32_t num,
                                                             uint32_t max_size,
                                                             uintptr_t* ptr_addr,
                                                             uint32_t* ptr_hdr_size,
                                                             uint32_t* ptr_pld_size,
                                                             bool gpu_mem,
                                                             uint16_t queue_idx = 0xFFFF);

  protected:
    RawPacketMessage(uint32_t num,
                     uint32_t max_size,
                     uintptr_t* ptr_addr,
                     uint32_t* ptr_hdr_size,
                     uint32_t* ptr_pld_size,
                     bool gpu_mem,
                     int queue_idx);

    uint32_t m_num;
    uint32_t m_max_size;
    uintptr_t* m_ptr_addr;
    uint32_t* m_ptr_hdr_size;
    uint32_t* m_ptr_pld_size;
    uint16_t m_queue_idx;
    bool m_gpu_mem;
};

struct RawPacketMessageProxy
{};

#pragma GCC visibility pop
}  // namespace morpheus