Giter VIP home page Giter VIP logo

hep-java's Introduction

HEP-JAVA

HEP/EEP Encapsulation Protocol Library for Java

This repository provides an example HEP3 library and reference decoder implementation for Developers and Integrators.

About HEP/EEP

EEP/HEP: Extensible Encapsulation protocol (“EEP” pronounced “HEPPY”) provides a method to duplicate an IP datagram to a collector by encapsulating the original datagram and its relative header properties (as payload, in form of concatenated chunks) within a new IP datagram transmitted over UDP/TCP/SCTP connections for remote collection. Encapsulation allows for the original content to be transmitted without altering the original IP datagram and header contents and provides flexible allocation of additional chunks containing additional arbitrary data.

HEP/EEP is currently supported natively in platforms such as Kamailio/SER, OpenSIPS, FreeSWITCH, Asterisk and tools such as Captagent, sipgrep, sngrep and more.

Build

mvn package

Usage Example

//...
import org.homer.hep.ParserHEPv3;
import org.homer.hep.HEPStructure;
//...

void consume(Socket socket) {
    // hep input stream      
    DataInputStream in = new DataInputStream(socket.getInputStream());

    // get header bytes
    byte[] header = new byte[4];
    byte[] expectedHeader = {0x48, 0x45, 0x50, 0x33};
    in.read(header);

    // check if header spells "HEP3"
    if (Arrays.equals(header, expectedHeader)){

        // get the payload length
        int len = in.readUnsignedShort();
        
        // get payload bytes
        byte[] bytes = new byte[len];
        in.read(bytes);

        // parse out HEP structure
        ParserHEPv3 parser = new ParserHEPv3();
        HEPStructure hepStructure = parser.parse(ByteBuffer.wrap(bytes), len, socket.getInetAddress().toString());
        // this prints out the HEP structure string representation
        System.out.println("HEP Structure: " + hepStructure);

        // grab payload from HEP structure
        String payload = new String(hepStructure.payloadByteMessage.array());
        //...
        //... do stuff with payload
        //...
    }
}

Support

For any question or comment, please visit http://sipcapture.org or contact [email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.