monitube2-data_packet.c File Reference

Relating to processing packets in the fast path. More...

#include "monitube2-data_main.h"
#include <jnx/msp_hw_ts.h>
#include <sys/jnx/jbuf.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include "monitube2-data_config.h"
#include "monitube2-data_conn.h"
#include "monitube2-data_rtp.h"
#include "monitube2-data_packet.h"

Go to the source code of this file.


#define MPEG_TS_PACKET_BYTES   (188)
#define MPEG_TS_HEADER_BYTES   (4)


static void checksum_adjust (unsigned char *chksum, unsigned char *optr, int olen, unsigned char *nptr, int nlen)
static void update_stats_for_flow (rtp_hdr_t *rh, flow_entry_t *flow, uint16_t length, uint16_t ssid, uint64_t *fpga_ts)
status_t pullup_bytes (struct jbuf **pkt_buf, uint16_t num_bytes)
void process_packet (struct jbuf *jb, flow_entry_t *flow, uint16_t ssid)

Detailed Description

Relating to processing packets in the fast path.

These functions and types will manage the packet processing in the data path

Definition in file monitube2-data_packet.c.

Define Documentation

#define MPEG_TS_HEADER_BYTES   (4)

This many bytes of each MPEG TS packet are purely header

Definition at line 42 of file monitube2-data_packet.c.

Referenced by update_stats_for_flow().

#define MPEG_TS_PACKET_BYTES   (188)

This many (188) bytes total in each MPEG TS packet (188 is standard) DVb-ASI uses 204 bytes. ATSC uses 208 bytes. Adjust accordingly.

Definition at line 37 of file monitube2-data_packet.c.

Referenced by update_stats_for_flow().

Function Documentation

static void checksum_adjust ( unsigned char *  chksum,
unsigned char *  optr,
int  olen,
unsigned char *  nptr,
int  nlen 
) [static]

This function will adjust a checksum. It is taken directly from the NAT RFC 3022. The algorithm below is applicable only for even offsets (i.e. optr below must be at an even offset from start of header) and even lengths (i.e. olen and nlen below must be even).

[in,out] chksum Checksum
[in] optr Pointer to old data to scan
[in] olen Length of old data to scan
[in] nptr Pointer to old data to scan
[in] nlen Length of new data to scan

Definition at line 71 of file monitube2-data_packet.c.

Referenced by process_packet().

void process_packet ( struct jbuf *  jb,
flow_entry_t flow,
uint16_t  ssid 

Process an IP packet that is UDP, and the UDP header must be available in the bytes following the IP address.

[in] jb The received jbuf for this packet
[in] flow The flow state
[in] ssid The service set id

Definition at line 314 of file monitube2-data_packet.c.

References flow_entry_s::age_ts, checksum_adjust(), DLOG, get_current_time(), flow_entry_s::m_vrf, flow_entry_s::maddr, pullup_bytes(), flow_entry_s::rate, and update_stats_for_flow().

Referenced by monitube_data_hdlr().

status_t pullup_bytes ( struct jbuf **  pkt_buf,
uint16_t  num_bytes 

Ensure or pullup enough data into the first jbuf of the chain in order to analyze it better where the bytes are contiguous

[in] pkt_buf The packet in jbuf format (chain of jbufs)
[in] num_bytes The number of contiguous bytes of data required in the first jbuf
Returns the result of the jbuf_pullup on the pkt_buf upon SUCCESS; otherwise pkt_buf remains unchanged and EFAIL is returned

Definition at line 281 of file monitube2-data_packet.c.

References DLOG.

Referenced by monitube_data_hdlr(), and process_packet().

static void update_stats_for_flow ( rtp_hdr_t rh,
flow_entry_t flow,
uint16_t  length,
uint16_t  ssid,
uint64_t *  fpga_ts 
) [static]

Calculate MDI stats for this flow

[in] data The payload data
[in] flow The locked flow entry
[in] length The length of payload data (under UDP/L4)
[in] ssid service set id
[in] fpga_ts Timestamp of packet delivery to HW

Definition at line 124 of file monitube2-data_packet.c.

References source_s::base_seq, flow_entry_s::base_ts, rtphdr::cc, source_s::cycles, flow_entry_s::daddr, DLOG, flow_entry_s::dport, source_s::expected_prior, source_s::max_seq, flow_entry_s::mdi_df, flow_entry_s::mdi_mlr, MIN_SEQUENTIAL, MPEG_TS_HEADER_BYTES, MPEG_TS_PACKET_BYTES, notify_stat_update(), flow_entry_s::pl_sum, source_s::probation, flow_entry_s::rate, source_s::received, source_s::received_prior, RTP_VERSION, rtphdr::seq, flow_entry_s::source, rtphdr::ssrc, flow_entry_s::ssrc, update_seq(), flow_entry_s::vb_max, flow_entry_s::vb_min, flow_entry_s::vb_post, flow_entry_s::vb_pre, and rtphdr::version.

Referenced by process_packet().

2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:27:09 2010 for SDK Your Net Corporation Monitube2 IPTV Monitoring Example: monitube2-plugin 1.0 by Doxygen 1.5.1