Contents

Contents at a Glance

About the Authors

Acknowledgments

Introduction

Scope

Organization

PART I: packetC Background

images CHAPTER 1: Origins of packetC

Tenets of packetC

Parallel Processing, Security, and Packet Orientation

images CHAPTER 2: Introduction to the packetC Language

packetC Language Design Considerations

packetC Language Similarities

Virtual Machine—packetC Behavior

Digging a Little Deeper into packetC vs. C

Case Sensitivity and Identifiers

Object Orientation and Control Flow

Memory Layout

Summary

images CHAPTER 3: Style Guidelines for packetC Program

Introduction to packetC Style Guidelines

Meaning of Wording in packetC Style Guidelines

Last Clarification

Naming Conventions for Variables, Types, and Functions

Variables

Types

Functions

Additional Conventions for Naming Variables, Types, and Functions

Source Code Presentation, Indentation, and Form

General Source Code Form

Include Files and Include Statements

Functions and Declarations

General Conditionals Formatting

Specific Conditionals Forms

General Commentary on Comments

File Comment Headers

Function Comment Headers

File Naming and Construction Conventions

Broader Coding Style Guideline Tips and Techniques

Variables, Types, and Functions

Conditional Layout and Form

Variables, Types, and Functions

Comments

images CHAPTER 4: Construction of a packetC Program

packetC and Parallelism

packetC Modules: Three Kinds of Compilation Units

Three Kinds of Scope

Module Structure and Scopes

Packet Module

Shared Module

Library Module

Graphical Representation of Scope Linkage

Run time Environment Data and Predefined Types

Packet ($PACKET pkt)

Packet Information Block ($PIB pib)

System Information ($SYS type)

images CHAPTER 5: Variables: Identifiers, Basic Scalar Data Types, and Literals

Classic Data Types

Identifiers and a Few Fundamentals

Basic Scalar Types

Literals

Integral Type Literals

Network Literals

String Literals

Character Literals

Network Byte Order

Unsupported Types

PART II: Language Reference

images CHAPTER 6: Data Initialization and Mathematical Expressions

Data Initialization, Expressions, and Operators

Variable and Constant Declarations

Variable and Constant Initialization

Classic C Expressions and Operators

Operators

Associativity

Multiplicative Operators

Additive Operators

Relational Operators

Equality Operators

Assignment Operators

Simple Assignment Operator

Compound Assignment Operators

Compound Repetition Assignment Operator

Increment and Decrement Operators

Post-Increment and Post-Decrement Operators

Prefix Increment and Prefix Decrement Operators

Logical AND Operator

Logical OR Operator

Logical and Bitwise NOT Operators (!, ~)

Bitwise AND Operator

Bitwise Exclusive OR (XOR) Operator

Bitwise Inclusive OR Operator

Bitwise Shift Operator

sizeof Operator

Get Field Offset Within Structures

Data Repetition Quantifier

Unsupported Operators

images CHAPTER 7: Functions

Function Constructs

Function Declarations and Prototypes

Function Construction

Function Invocations

Function Declaration and Function Call Restrictions

Parameter Passing Modes

Inlining

Function Parameter and Return Types

Function Return Statements

Function Calls

images CHAPTER 8: packetC Data Type Fundamentals

Data Type Fundamentals

packetC Fundamental Types

Type Compatibility, Conversions, and Casts

Type Promotions, Conversions, and Implicit Casting

Numeric Literals and Implicit Type Casting

Explicit Type Casts

Cast Operators

Strong Type Casting

Type Declarations

Base Types

Variable Declaration Specifiers

Constant and Constant Integral Expressions

images CHAPTER 9: C-Style Data Types

Enumeration Types

Arrays

Array Subscripting Operator

Unsized Dimensions

Array Assignment

Array Slicing

Array Initialization

Structures and Unions

Unions

Structures

Structure Alignment

Types, Tags, and Name Visibility

Bitfields

A Discussion on Container-Based Bitfields

images CHAPTER 10: Basic Packet Interaction and Operations

Interaction with the Packet through Unique-to-packetC Capabilities

Get Packet Offset

Packet Operators

Packet Delete

Packet Insert

Packet Replicate

Packet Requeue

images CHAPTER 11: Selection Statements

Covering packetC Basic Control Statements

Compound Statement

Conditional Expressions

If Statement

Switch Statement

Null Statement

Expression Statement

images CHAPTER 12: Loops and Flow Control

Control Statements

Looping (Iteration) Statements

Jump Statements

images CHAPTER 13: Exception Handling

Exception Handling in packetC

Try-Catch-Throw Statements (Error Handling)

Error Handling (try-catch-throw)

System-Defined Response

Errors Section from cloudshield.ph

Simple Program Flow with Try-Catch-Throw Implemented

images CHAPTER 14: packetC Database Types and Operations

Database Declarations

Databases and Masking

Database Limitations and Padding

Database Records and Elements

Masks

Database Subscripting Operator

Database Delete

Database Insert

Database Match

Operator Invocations

Example Database Application

Example Database Application (ACL)

images CHAPTER 15: packetC Search Set Types and Operations

Searchsets in packetC for Unstructured Content Analysis

Searchsets

Searchset Declarations

Constant Searchsets and Sizes

Null Termination Issues

Match Operator

Find Operator

Regex Specifier

Interaction of packetC Pre-Processor with Regular Expressions

General Search Set Usage, Operation, and Mechanics

Searchset Example Application

images CHAPTER 16: Reference Type and Operations

References in packetC

References

Reference Declarations

Assigning Values to References

Dereferencing References

Using References

Reference Operators

deref (dereference operator)

Developing Linked Lists Without Pointers

images CHAPTER 17: Semaphores in packetC

Locking and Unlocking

Lock and Unlock Operators

Lock Operator

Unlock Operator

Using Lock and Unlock to Perform a Global Malloc() and Free()

images CHAPTER 18: Packet Information Block and System Packet Operations

Shared Definitions

Packet ($PACKET pkt)

Packet Information Block ($PIB pib)

System Information ($SYS sys)

TCP/IP Stack Decode for pib Layer Offset Calculations

Layer 2 Ethernet Header Decode Procedure

Layer 2 Ethernet 802.1Q (VLAN) Decode Procedure

Layer 2 SONET Header Decode Procedure

Layer 2 ½ MPLS Label Stack Decode Procedure

Layer 3 IPv4 and IPv6 Header Decode Procedure

Example cloudshield.ph Include File

images CHAPTER 19: Descriptor Type and Operations

packetC Descriptor Types

Descriptors

Descriptor Example Application

Detailed View and Description of Descriptors

Complex Descriptor Structure and Union Usage

Background on Parallel Processing Paradigm and Relation to Descriptors

The Descriptor Construct

Impacts on Performance

PART III: Developing Applications

images CHAPTER 20: Control Plane and System Interaction

Control Plane Interaction

Alerts and Information Logging

alert Statement

log Statement

Messages to Control Plane ($MSG_TYPE)

Messages Portion of cloudshield.ph

images CHAPTER 21: packetC Pre-Processor

#define

#include

#ifdef

#ifndef

#endif

#if

#else

#elif

#undef

#error

#line

#file

defined

Comments in Code

Classic C-Style Comment

Multi-Line Comments C Style

Classic C++-Style Comment

Multi-Line Comments C++ Style

Valid Nesting of Comment Blocks

Miscellaneous Comments Examples

Typical packetC Comment Header

images CHAPTER 22: Pragmas and Other Key Compiler Directives

Pragmas

Implementation-Defined Pragmas

Interaction of packetC Pre-Processor with Regular Expressions

images CHAPTER 23: Developing Large Applications in packetC

Planning for Large Projects in packetC

Things to Consider in Large Application Development

Follow a Common Style

Plan Out Modularity in Your Programs

Set Up the Production Environment Early

Leverage Include Files Well

Be Careful, Be Clear, and Be Code

It’s All About Data-Driven Code—Follow the Flow

Programs Large and Small—Plan Appropriately

images CHAPTER 24: Construction of a packetC Executable

A View into the CloudShield PacketWorks IDE Tools

images CHAPTER 25: packetC Standard Networking Descriptors

Standard Include File protocols.ph Example

images CHAPTER 26: Developing for Performance

Developing for Performance in packetC

Counting Bits Set

Simplest Computation Scenario

Improving the Computational Algorithm

Altering the Algorithm with Memory Use in Exchange of Processing

Metadata Analysis

Netflow Record Generation

DDoS Trend Analysis

VoIP QoS Analysis

Processing Minimization

Whatever You Do … Don’t Involve Other Contexts

images CHAPTER 27: Standard Libraries

Assessment of C Standard Library Functions

assert.h - Directly Applicable

complex.h - Not Applicable

ctype.h - Directly Applicable

error.h - Not Applicable

fenv.h - Not Applicable

float.h - Not Applicable

inttypes.h - Partially Applicable

iso646.h - Directly Applicable

limits.h - Directly Applicable

locale.h - Not Applicable

math.h - Partially Applicable

tgmath.h - Partially Applicable

setjmp.h - Not Applicable

signals.h - Not Applicable

stdarg.h - Not Applicable

stdbool.h - Directly Applicable

stddef.h - Partially Applicable

stdint.h - Partially Applicable

stdio.h - Partially Applicable

stdlib.h - Directly Applicable

string.h - Directly Applicable

time.h - Directly Applicable

wchar.h - Not Applicable

wctype.h - Not Applicable

packetC Standard Libraries

cloudshield.ph—Required Platform Specific System Include (See Chapter 18)

protocols.ph—Common Layer 2 through 4 Packet Descriptors (See Chapter 19)

ascii.ph—Named Values for ASCII Characters

limits.ph—A packetC Replacement for C limits.h Functionality

moreprotocols.ph—Named Values for Network Protocol Field Values

namedoperators.ph—Replacement for iso646.h Named Operators

stdlib.ph—packetC Implementation of Many stdlib.h Functions

time.ph—packetC Implementation of Many time.h Functions

trojanprotocols.ph—Named Values for Port Numbers Trojan Network Protocol Operate on

ascii.ph - Named Values for ASCII Characters

limits.ph - A packetC Replacement For C limits.h Functionality

moreprotocols.ph - Named Values For Network Protocol Field Values

namedoperators.ph - Replacement for iso646.h Named Operators

trojanprotocols.ph - Named Values for Port Numbers Trojan Network Protocol Operate On

PART IV: Industry Reprints

images REPRINT 1: packetC Language for High Performance Packet Processing

images REPRINT 2: A Paradigm for Processing Network Protocols in Parallel

images REPRINT 3: Dynamically Accessing Packet Header Fields at High-speed

images REPRINT 4: packetC Language and Parallel Processing of Masked Databases

images REPRINT 5: Packet Content Matching with packetC Searchsets

images REPRINT 6: References for Run-time Aggregate Selection with Strong Typing

images REPRINT 7: Portable Bit Fields in packetC

images REPRINT 8: packet Field and Bitfield Allocation Order

images REPRINT 9: Managing Heterogeneous Architectures for High-speed Packet Processing

images APPENDIX A: Reference Tables

Keywords

Unit Keywords

Declaration Keywords

Pragma Keywords

Expression Keywords

Method Keywords

Statement Keywords

packetC Pre-Defined Keywords

ASCII Table with Decimal to Hexadecimal Conversion

Bits and Bytes

TCP/IP and OSI Model Network Stack

Header Formats

Basic Ethernet II Header Format

Ethernet Header with VLAN Tag (802.1Q) Format

Ethernet Header with Stacked VLAN Tags (802.1Q in Q) Format

IPv4 Header

IPv6 Header

TCP Header

UDP Header

ICMP Header

images APPENDIX B: Open Systems Vendors for packetC

Software

Hardware

Reference

images APPENDIX C: Glossary

PacketC Language Terms

Networking Terms

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.148.103.210