Skip to main content

Diameter codec - encoder & decoder

How to setup dev env

  • apt install python3.6
  • apt install python3.6-venv
  • source venv/bin/activate
  • pip install -r requirements.txt
  • pylint src/main/python/codec/diameter/ --ignored-classes=_socketobject *.py

How to build project

  • pyb -v
  • pyb -Q

How to upload project to test.pypi with twine

How to upload project to pypi with twine (production)

  • python -m twine upload target/dist/diameter-codec-<x.y.z>/dist/*

How to push git tag

  • git push origin v<x.y.z>

How to encode and decode Capabilities-Exchange message

import os  
import typing    
from codec.diameter.diameter import DiameterHeader, Diameter, Avp  
from codec.diameter.dictionary import DictionaryLayout, DefaultDictionaryLayout	
cer_request: typing.Tuple = (  
  Avp("Product-Name", "hello"),  
  Avp("Origin-Realm", "zte.com.cn"),  
  Avp("Origin-Host", "dmtsrv001.zte.com.cn"),  
  Avp("Host-IP-Address", "192.168.0.1"),  
  Avp("Vendor-Id", 10415),  
  Avp("Product-Name", "dummy-product"),  
  Avp("Inband-Security-Id", 1),  
  Avp("Vendor-Specific-Application-Id", (  
     Avp("Vendor-Id", 10415),  
     Avp("Acct-Application-Id", 1),  
     Avp("Auth-Application-Id", 1),  
  )),  
  Avp("Vendor-Specific-Application-Id", (  
     Avp("Auth-Application-Id", 2),  
     Avp("Acct-Application-Id", 2),  
     Avp("Vendor-Id", 10415),  
  )),  
)
header: DiameterHeader = DiameterHeader(application_id=0, command_code=257, avp_set=cer_request)
xml_dict_path: str = <path to diameter xml file>  
dictionary_layout: DictionaryLayout = DefaultDictionaryLayout(xml_dict_path)  
diameter: Diameter = Diameter(dictionary_layout)
encoded_header: bytes = self.diameter.encode(header) #	send to TCP server     
decoded_header: DiameterHeader = diameter.decode(encoded_header) # decoded on TCP server

Metadata

Release files for diameter-codec 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diameter-codec 1.0.3
File Size Uploaded
diameter-codec-1.0.3.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for diameter-codec 1.0.3
File Interpreter ABI Platform
diameter_codec-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 23.7 kB

Release files / diameter-codec-1.0.3.tar.gz

Download URL diameter-codec-1.0.3.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
632f8919292e7175437c50fef52c30ef3f15cae2a527f70c8ae8de0741e87eac
BLAKE2b-256 checksum
How to use checksums
f2989829f1df9248fade0062a8d2f57c268a3701208e1348318896b03ff3c79f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / diameter_codec-1.0.3-py3-none-any.whl

Download URL diameter_codec-1.0.3-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed0e90fff9513f82d5c798c43a8834c3cffa2034a9a46ec7e8e6b6ea40a80a70
BLAKE2b-256 checksum
How to use checksums
4dfd2b4a134dd34464a088a6526a394f88e3014aa11a43ec31eeac646980895a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page