Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sipcapture/hep-java
HEP: JAVA implementation of HEP/EEP Encapsulation Protocol
https://github.com/sipcapture/hep-java
Last synced: 23 days ago
JSON representation
HEP: JAVA implementation of HEP/EEP Encapsulation Protocol
- Host: GitHub
- URL: https://github.com/sipcapture/hep-java
- Owner: sipcapture
- License: gpl-3.0
- Created: 2014-12-03T11:11:05.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-08-29T10:32:40.000Z (over 2 years ago)
- Last Synced: 2024-07-31T19:17:58.297Z (4 months ago)
- Language: Java
- Homepage: http://sipcapture.org
- Size: 30.3 KB
- Stars: 5
- Watchers: 8
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-hep - Java
README
# HEP-JAVA
### HEP/EEP Encapsulation Protocol Library for JavaThis repository provides an example [HEP3](http://hep.sipcapture.org/) library and reference decoder implementation for Developers and Integrators.
#### About HEP/EEP
EEP/HEP: Extensible Encapsulation protocol 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]