%% Write 5G NR User-Defined Custom Block to PCAPNG File
% Create a default PCAPNG file writer object.

pcapngObj = pcapngWriter;

% Write the interface block for 5G New Radio (NR). 5G NR packets do not have a valid link type. As per Tcpdump, if a valid link type is not present, specify the link type of SLL packet.

interface = '5GNR';         % Interface name
linkType = 113;             % Link type of SLL packet
interfaceID = writeInterfaceDescriptionBlock(pcapngObj,linkType,interface);

% Write the custom block to specify user-defined data.

writeCustomBlock(pcapngObj,"This block writes user-defined data");

% Copyright 2020 The MathWorks, Inc.