# DoIP Server
A Python implementation of DoIP (Diagnostics over Internet Protocol) server and client with comprehensive YAML configuration management.
## ๐ Quick Start
```bash
# Install dependencies
poetry install
# Run with hierarchical configuration
poetry run python src/doip_server/main.py --gateway-config config/gateway1.yaml
# Test UDP Vehicle Identification
python scripts/utilities/run_udp_client.py --verbose
# Test Functional Diagnostics
python scripts/test/test_functional_diagnostics.py
# Test Hierarchical Configuration
python -m pytest tests/test_hierarchical_configuration.py -v
# Run comprehensive test suite
poetry run pytest tests/ -v
```
## ๐ Documentation
Comprehensive documentation is available in the `docs/` directory:
- **[๐ Documentation Index](docs/INDEX.md)** - Complete documentation index
- **[๐ Getting Started](docs/README.md)** - Detailed project overview and setup
- **[โ๏ธ Configuration Guide](docs/CONFIGURATION.md)** - Complete configuration guide
- **[๐ง API Reference](docs/API.md)** - API reference and examples
- **[๐งช Testing Guide](docs/TESTING.md)** - Testing guide and results
- **[๐ Deployment Guide](docs/DEPLOYMENT.md)** - Deployment and CI/CD guide
- **[๐ค Contributing](docs/CONTRIBUTING.md)** - How to contribute to this project
- **[๐ Changelog](docs/CHANGELOG.md)** - Project changelog and release notes
- **[๐ Security](docs/SECURITY.md)** - Security policy and vulnerability reporting
- **[๐ Code of Conduct](docs/CODE_OF_CONDUCT.md)** - Community guidelines
## โจ Key Features
### ๐๏ธ Hierarchical Configuration System
- **Multi-File Architecture**: Gateway, ECU, and UDS services in separate files
- **Dynamic ECU Loading**: Add/remove ECUs at runtime without code changes
- **Service Isolation**: ECU-specific services with common service sharing
- **Address Validation**: Per-ECU source and target address validation
- **Configuration Validation**: Comprehensive validation with clear error reporting
### ๐ง Functional Diagnostics
- **Broadcast Communication**: Single request to multiple ECUs simultaneously
- **Functional Addressing**: Default 0x1FFF address for broadcast requests
- **Service Filtering**: Only ECUs supporting the service with functional addressing respond
- **Efficient Diagnostics**: Reduce network traffic and improve diagnostic efficiency
- **Flexible Configuration**: Per-service functional addressing support
### ๐ Advanced Features
- **Response Cycling**: Automatic cycling through multiple responses per UDS service
- **No Response Configuration**: Configure services that don't send responses (Issue #35)
- **UDP Vehicle Identification**: Network discovery via UDP broadcasts
- **Per-ECU Services**: ECU-specific UDS service definitions
- **Comprehensive Testing**: 99.5% test pass rate with full core functionality
- **Backward Compatibility**: Support for legacy configuration formats
## ๐๏ธ Architecture
### Hierarchical Configuration System
The DoIP server uses a sophisticated hierarchical configuration system that separates concerns into three main components:
```
config/
โโโ gateway1.yaml # Gateway network configuration & ECU references
โโโ ecu_engine.yaml # Engine ECU configuration (0x1000)
โโโ ecu_transmission.yaml # Transmission ECU configuration (0x1001)
โโโ ecu_abs.yaml # ABS ECU configuration (0x1002)
โโโ uds_services.yaml # UDS service definitions (common + ECU-specific)
```
### Configuration Components
```mermaid
graph LR
subgraph "Configuration File Structure"
GW["gateway1.yaml<br/>Gateway Configuration<br/>Network Settings<br/>Protocol Config<br/>ECU References<br/>Logging & Security"]
subgraph "ECU Configuration Files"
ECU1["ecu_engine.yaml<br/>Engine ECU (0x1000)<br/>Target Address<br/>Functional Address<br/>Tester Addresses<br/>Service References"]
ECU2["ecu_transmission.yaml<br/>Transmission ECU (0x1001)<br/>Target Address<br/>Functional Address<br/>Tester Addresses<br/>Service References"]
ECU3["ecu_abs.yaml<br/>ABS ECU (0x1002)<br/>Target Address<br/>Functional Address<br/>Tester Addresses<br/>Service References"]
end
subgraph "Service Configuration Files"
COMMON["generic_uds_messages.yaml<br/>Common UDS Services<br/>Read VIN<br/>Session Control<br/>Tester Present<br/>Vehicle Type"]
ENGINE["ecu_engine_services.yaml<br/>Engine-Specific Services<br/>Engine Diagnostics<br/>Engine Parameters<br/>Engine Controls"]
TRANS["ecu_transmission_services.yaml<br/>Transmission Services<br/>Transmission Diagnostics<br/>Gear Status<br/>Transmission Controls"]
ABS["ecu_abs_services.yaml<br/>ABS Services<br/>ABS Diagnostics<br/>Wheel Speed<br/>Brake Controls"]
end
end
%% Relationships
GW --> ECU1
GW --> ECU2
GW --> ECU3
ECU1 --> COMMON
ECU1 --> ENGINE
ECU2 --> COMMON
ECU2 --> TRANS
ECU3 --> COMMON
ECU3 --> ABS
%% Styling
classDef gatewayClass fill:#e3f2fd,stroke:#0277bd,stroke-width:3px
classDef ecuClass fill:#f1f8e9,stroke:#388e3c,stroke-width:2px
classDef serviceClass fill:#fce4ec,stroke:#c2185b,stroke-width:2px
class GW gatewayClass
class ECU1,ECU2,ECU3 ecuClass
class COMMON,ENGINE,TRANS,ABS serviceClass
```
#### 1. Gateway Configuration (`gateway1.yaml`)
- **Network Settings**: TCP/IP host, port, max connections, timeouts
- **Protocol Configuration**: DoIP version, inverse version
- **ECU References**: Dynamic list of ECU configuration files
- **Response Codes**: Gateway-level response configuration
- **Logging & Security**: Centralized logging and security settings
#### 2. ECU Configurations (`ecu_*.yaml`)
- **ECU Identity**: Name, description, target address
- **Functional Address**: Broadcast address for functional diagnostics (default: 0x1FFF)
- **Tester Addresses**: Allowed source addresses per ECU
- **Service References**: Common services + ECU-specific services
- **ECU-Specific Settings**: Custom configuration per ECU
#### 3. UDS Services Configuration (`uds_services.yaml`)
- **Common Services**: Available to all ECUs (Read VIN, Diagnostic Session Control, etc.)
- **ECU-Specific Services**: Engine, Transmission, ABS specific services
- **Functional Addressing Support**: Services marked for broadcast capability
- **Response Cycling**: Multiple response options per service
### Configuration Flow Diagram
```mermaid
graph TB
subgraph "DoIP Server Architecture"
subgraph "Configuration Layer"
GW["Gateway Configuration<br/>gateway1.yaml<br/>Network Settings<br/>Protocol Config<br/>ECU References<br/>Logging & Security"]
subgraph "ECU Configurations"
ECU1["Engine ECU<br/>0x1000<br/>Target Address<br/>Functional Address<br/>Tester Addresses"]
ECU2["Transmission ECU<br/>0x1001<br/>Target Address<br/>Functional Address<br/>Tester Addresses"]
ECU3["ABS ECU<br/>0x1002<br/>Target Address<br/>Functional Address<br/>Tester Addresses"]
end
subgraph "UDS Services"
COMMON["Common Services<br/>Read VIN<br/>Session Control<br/>Tester Present<br/>Vehicle Type"]
SPECIFIC["ECU-Specific Services<br/>Engine Services<br/>Transmission Services<br/>ABS Services"]
end
end
subgraph "DoIP Server Core"
UDP["UDP Handler<br/>Vehicle Identification<br/>VIN Requests<br/>Entity Status<br/>Power Mode"]
TCP["TCP Handler<br/>Diagnostic Sessions<br/>Routing Activation<br/>Connection Management<br/>Keep-Alive"]
UDS["UDS Message Handler<br/>Diagnostic Processing<br/>Service Routing<br/>Response Generation<br/>Error Handling"]
end
subgraph "Communication Layer"
PHYSICAL["Physical Addressing<br/>Direct ECU Communication<br/>Single ECU Response<br/>Specific Target Address"]
FUNCTIONAL["Functional Addressing<br/>Broadcast Communication<br/>Multiple ECU Response<br/>Service Filtering<br/>0x1FFF Address"]
end
subgraph "Client Interface"
CLIENT["DoIP Client<br/>Connection Management<br/>Message Sending<br/>Response Handling"]
end
end
%% Configuration Flow
GW --> ECU1
GW --> ECU2
GW --> ECU3
GW --> COMMON
GW --> SPECIFIC
%% Service Assignment
COMMON --> ECU1
COMMON --> ECU2
COMMON --> ECU3
SPECIFIC --> ECU1
SPECIFIC --> ECU2
SPECIFIC --> ECU3
%% Server Processing
UDP --> UDS
TCP --> UDS
UDS --> PHYSICAL
UDS --> FUNCTIONAL
%% Client Communication
CLIENT --> UDP
CLIENT --> TCP
CLIENT --> PHYSICAL
CLIENT --> FUNCTIONAL
%% Styling
classDef configClass fill:#e1f5fe,stroke:#01579b,stroke-width:2px
classDef serverClass fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
classDef commClass fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
classDef clientClass fill:#fff3e0,stroke:#e65100,stroke-width:2px
class GW,ECU1,ECU2,ECU3,COMMON,SPECIFIC configClass
class UDP,TCP,UDS serverClass
class PHYSICAL,FUNCTIONAL commClass
class CLIENT clientClass
```
### Communication Flow Diagram
```mermaid
sequenceDiagram
participant Client as DoIP Client
participant UDP as UDP Handler
participant TCP as TCP Handler
participant UDS as UDS Handler
participant ECU1 as Engine ECU
participant ECU2 as Transmission ECU
participant ECU3 as ABS ECU
Note over Client,ECU3: Vehicle Identification (UDP)
Client->>UDP: Vehicle Identification Request
UDP->>Client: VIN + Entity Status Response
Note over Client,ECU3: Diagnostic Session Setup (TCP)
Client->>TCP: TCP Connection Request
TCP->>Client: Connection Established
Client->>TCP: Routing Activation Request
TCP->>Client: Routing Activation Response
Note over Client,ECU3: Physical Addressing (Single ECU)
Client->>TCP: UDS Request (Target: 0x1000)
TCP->>UDS: Route to Engine ECU
UDS->>ECU1: Process UDS Service
ECU1->>UDS: UDS Response
UDS->>TCP: Forward Response
TCP->>Client: UDS Response
Note over Client,ECU3: Functional Addressing (Multiple ECUs)
Client->>TCP: UDS Request (Target: 0x1FFF)
TCP->>UDS: Route to All ECUs
UDS->>ECU1: Process UDS Service
UDS->>ECU2: Process UDS Service
UDS->>ECU3: Process UDS Service
ECU1->>UDS: UDS Response (if supported)
ECU2->>UDS: UDS Response (if supported)
ECU3->>UDS: UDS Response (if supported)
UDS->>TCP: Aggregate Responses
TCP->>Client: Multiple UDS Responses
Note over Client,ECU3: Session Maintenance
Client->>TCP: Tester Present
TCP->>UDS: Keep-Alive Processing
UDS->>ECU1: Update Session Status
UDS->>ECU2: Update Session Status
UDS->>ECU3: Update Session Status
```
### Benefits of Hierarchical Configuration
#### ๐ฏ **Separation of Concerns**
- **Gateway Configuration**: Network and protocol settings centralized
- **ECU Configuration**: Individual ECU settings isolated and manageable
- **Service Configuration**: UDS services organized by category and ECU
#### ๐ **Dynamic Management**
- **Runtime ECU Loading**: Add/remove ECUs without server restart
- **Service Isolation**: ECU-specific services don't interfere with others
- **Easy Scaling**: Add new ECUs by simply adding configuration files
#### ๐ก๏ธ **Enhanced Security & Validation**
- **Per-ECU Address Validation**: Source addresses validated per ECU
- **Service Authorization**: Only authorized services available per ECU
- **Configuration Validation**: Comprehensive validation with clear error messages
#### ๐ **Improved Maintainability**
- **Modular Structure**: Easy to understand and modify
- **Clear Ownership**: Each configuration file has a specific purpose
- **Backward Compatibility**: Legacy configurations still supported
## ๐ง Functional Diagnostics
### Overview
The DoIP server supports **functional diagnostics**, enabling broadcast communication to multiple ECUs using a single request. This powerful feature allows clients to efficiently communicate with multiple ECUs simultaneously.
### Key Concepts
#### Functional Addressing
- **Functional Address**: Special logical address (default: `0x1FFF`) representing multiple ECUs
- **Broadcast Communication**: Single request sent to multiple ECUs that support the service
- **Service Filtering**: Only ECUs supporting the requested UDS service with functional addressing respond
#### Physical vs Functional Addressing
- **Physical Addressing**: Direct communication with specific ECU using unique logical address
- **Functional Addressing**: Broadcast communication to multiple ECUs using shared functional address
### Configuration
#### ECU Configuration
Each ECU configuration includes a functional address:
```yaml
ecu:
name: "Engine_ECU"
target_address: 0x1000
functional_address: 0x1FFF # Broadcast address
tester_addresses: [0x0E00, 0x0E01, 0x0E02]
```
#### UDS Services Configuration
Services supporting functional addressing are marked:
```yaml
common_services:
Read_VIN:
request: "0x22F190"
responses: ["0x62F1901020011223344556677889AABB"]
supports_functional: true # Enables broadcast capability
```
### Usage Examples
#### Basic Functional Request
```python
from doip_client.doip_client import DoIPClientWrapper
# Create client
client = DoIPClientWrapper(
server_host="127.0.0.1",
server_port=13400,
logical_address=0x0E00,
target_address=0x1000
)
# Connect and send functional request
client.connect()
response = client.send_functional_read_data_by_identifier(0xF190) # Read VIN
print(f"Response: {response.hex()}")
client.disconnect()
```
#### Functional vs Physical Comparison
```python
# Physical addressing - Engine ECU only
response_physical = client.send_read_data_by_identifier(0xF190)
# Functional addressing - All ECUs that support it
response_functional = client.send_functional_read_data_by_identifier(0xF190)
```
### Supported Services
#### Common Services (All ECUs)
- `Read_VIN` - Vehicle Identification Number
- `Read_Vehicle_Type` - Vehicle Type Information
- `Diagnostic_Session_Control` - Session management
- `Tester_Present` - Keep-alive functionality
#### ECU-Specific Services
- `Engine_Diagnostic_Codes` - Engine trouble codes
- `Transmission_Diagnostic_Codes` - Transmission trouble codes
- `ABS_Diagnostic_Codes` - ABS trouble codes
### Testing
```bash
# Test functional diagnostics
python scripts/test/test_functional_diagnostics.py
# Run functional demo
python -c "from doip_client.doip_client import DoIPClientWrapper; DoIPClientWrapper().run_functional_demo()"
```
## ๐ Test Status
- **Unit Tests**: 17/17 โ
(100%)
- **Hierarchical Config Tests**: 21/21 โ
(100%)
- **Response Cycling Tests**: 9/9 โ
(100%)
- **Legacy Integration Tests**: 13/13 โ
(100%)
- **Client Extended Tests**: 25/25 โ
(100%)
- **Main Module Tests**: 12/12 โ
(100%)
- **Validate Config Tests**: 15/15 โ
(100%)
- **Debug Client Tests**: 30/30 โ
(100%)
- **Demo Tests**: 5/6 โ
(83% - 1 skipped)
- **Overall**: 185/186 tests passing (99.5% success rate)
## ๐ง Development
```bash
# Run tests
poetry run pytest tests/ -v
# Run specific test categories
poetry run pytest tests/test_doip_unit.py -v
poetry run pytest tests/test_hierarchical_configuration.py -v
poetry run pytest tests/test_response_cycling.py -v
```
## ๐ Documentation
For detailed documentation, see the [docs/](docs/) directory or start with the [Documentation Index](docs/INDEX.md).
---
*For complete documentation and implementation details, see the [docs/](docs/) directory.*
Raw data
{
"_id": null,
"home_page": null,
"name": "doip-server",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.15,>=3.10",
"maintainer_email": null,
"keywords": "doip, diagnostics, automotive, uds, iso13400, server, client",
"author": "Alonso Ramirez",
"author_email": "alonsoram07@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e0/f9/de9a9c377b93a5bcb410923b44ce1b5c95bb10ef1e808f7e1cec8293153a/doip_server-0.5.2.tar.gz",
"platform": null,
"description": "# DoIP Server\n\nA Python implementation of DoIP (Diagnostics over Internet Protocol) server and client with comprehensive YAML configuration management.\n\n## \ud83d\ude80 Quick Start\n\n```bash\n# Install dependencies\npoetry install\n\n# Run with hierarchical configuration\npoetry run python src/doip_server/main.py --gateway-config config/gateway1.yaml\n\n# Test UDP Vehicle Identification\npython scripts/utilities/run_udp_client.py --verbose\n\n# Test Functional Diagnostics\npython scripts/test/test_functional_diagnostics.py\n\n# Test Hierarchical Configuration\npython -m pytest tests/test_hierarchical_configuration.py -v\n\n# Run comprehensive test suite\npoetry run pytest tests/ -v\n```\n\n## \ud83d\udcda Documentation\n\nComprehensive documentation is available in the `docs/` directory:\n\n- **[\ud83d\udcd6 Documentation Index](docs/INDEX.md)** - Complete documentation index\n- **[\ud83d\ude80 Getting Started](docs/README.md)** - Detailed project overview and setup\n- **[\u2699\ufe0f Configuration Guide](docs/CONFIGURATION.md)** - Complete configuration guide\n- **[\ud83d\udd27 API Reference](docs/API.md)** - API reference and examples\n- **[\ud83e\uddea Testing Guide](docs/TESTING.md)** - Testing guide and results\n- **[\ud83d\ude80 Deployment Guide](docs/DEPLOYMENT.md)** - Deployment and CI/CD guide\n- **[\ud83e\udd1d Contributing](docs/CONTRIBUTING.md)** - How to contribute to this project\n- **[\ud83d\udccb Changelog](docs/CHANGELOG.md)** - Project changelog and release notes\n- **[\ud83d\udd12 Security](docs/SECURITY.md)** - Security policy and vulnerability reporting\n- **[\ud83d\udcdc Code of Conduct](docs/CODE_OF_CONDUCT.md)** - Community guidelines\n\n## \u2728 Key Features\n\n### \ud83c\udfd7\ufe0f Hierarchical Configuration System\n- **Multi-File Architecture**: Gateway, ECU, and UDS services in separate files\n- **Dynamic ECU Loading**: Add/remove ECUs at runtime without code changes\n- **Service Isolation**: ECU-specific services with common service sharing\n- **Address Validation**: Per-ECU source and target address validation\n- **Configuration Validation**: Comprehensive validation with clear error reporting\n\n### \ud83d\udd27 Functional Diagnostics\n- **Broadcast Communication**: Single request to multiple ECUs simultaneously\n- **Functional Addressing**: Default 0x1FFF address for broadcast requests\n- **Service Filtering**: Only ECUs supporting the service with functional addressing respond\n- **Efficient Diagnostics**: Reduce network traffic and improve diagnostic efficiency\n- **Flexible Configuration**: Per-service functional addressing support\n\n### \ud83d\ude80 Advanced Features\n- **Response Cycling**: Automatic cycling through multiple responses per UDS service\n- **No Response Configuration**: Configure services that don't send responses (Issue #35)\n- **UDP Vehicle Identification**: Network discovery via UDP broadcasts\n- **Per-ECU Services**: ECU-specific UDS service definitions\n- **Comprehensive Testing**: 99.5% test pass rate with full core functionality\n- **Backward Compatibility**: Support for legacy configuration formats\n\n## \ud83c\udfd7\ufe0f Architecture\n\n### Hierarchical Configuration System\n\nThe DoIP server uses a sophisticated hierarchical configuration system that separates concerns into three main components:\n\n```\nconfig/\n\u251c\u2500\u2500 gateway1.yaml # Gateway network configuration & ECU references\n\u251c\u2500\u2500 ecu_engine.yaml # Engine ECU configuration (0x1000)\n\u251c\u2500\u2500 ecu_transmission.yaml # Transmission ECU configuration (0x1001)\n\u251c\u2500\u2500 ecu_abs.yaml # ABS ECU configuration (0x1002)\n\u2514\u2500\u2500 uds_services.yaml # UDS service definitions (common + ECU-specific)\n```\n\n### Configuration Components\n\n```mermaid\ngraph LR\n subgraph \"Configuration File Structure\"\n GW[\"gateway1.yaml<br/>Gateway Configuration<br/>Network Settings<br/>Protocol Config<br/>ECU References<br/>Logging & Security\"]\n \n subgraph \"ECU Configuration Files\"\n ECU1[\"ecu_engine.yaml<br/>Engine ECU (0x1000)<br/>Target Address<br/>Functional Address<br/>Tester Addresses<br/>Service References\"]\n ECU2[\"ecu_transmission.yaml<br/>Transmission ECU (0x1001)<br/>Target Address<br/>Functional Address<br/>Tester Addresses<br/>Service References\"]\n ECU3[\"ecu_abs.yaml<br/>ABS ECU (0x1002)<br/>Target Address<br/>Functional Address<br/>Tester Addresses<br/>Service References\"]\n end\n \n subgraph \"Service Configuration Files\"\n COMMON[\"generic_uds_messages.yaml<br/>Common UDS Services<br/>Read VIN<br/>Session Control<br/>Tester Present<br/>Vehicle Type\"]\n ENGINE[\"ecu_engine_services.yaml<br/>Engine-Specific Services<br/>Engine Diagnostics<br/>Engine Parameters<br/>Engine Controls\"]\n TRANS[\"ecu_transmission_services.yaml<br/>Transmission Services<br/>Transmission Diagnostics<br/>Gear Status<br/>Transmission Controls\"]\n ABS[\"ecu_abs_services.yaml<br/>ABS Services<br/>ABS Diagnostics<br/>Wheel Speed<br/>Brake Controls\"]\n end\n end\n \n %% Relationships\n GW --> ECU1\n GW --> ECU2\n GW --> ECU3\n \n ECU1 --> COMMON\n ECU1 --> ENGINE\n ECU2 --> COMMON\n ECU2 --> TRANS\n ECU3 --> COMMON\n ECU3 --> ABS\n \n %% Styling\n classDef gatewayClass fill:#e3f2fd,stroke:#0277bd,stroke-width:3px\n classDef ecuClass fill:#f1f8e9,stroke:#388e3c,stroke-width:2px\n classDef serviceClass fill:#fce4ec,stroke:#c2185b,stroke-width:2px\n \n class GW gatewayClass\n class ECU1,ECU2,ECU3 ecuClass\n class COMMON,ENGINE,TRANS,ABS serviceClass\n```\n\n#### 1. Gateway Configuration (`gateway1.yaml`)\n- **Network Settings**: TCP/IP host, port, max connections, timeouts\n- **Protocol Configuration**: DoIP version, inverse version\n- **ECU References**: Dynamic list of ECU configuration files\n- **Response Codes**: Gateway-level response configuration\n- **Logging & Security**: Centralized logging and security settings\n\n#### 2. ECU Configurations (`ecu_*.yaml`)\n- **ECU Identity**: Name, description, target address\n- **Functional Address**: Broadcast address for functional diagnostics (default: 0x1FFF)\n- **Tester Addresses**: Allowed source addresses per ECU\n- **Service References**: Common services + ECU-specific services\n- **ECU-Specific Settings**: Custom configuration per ECU\n\n#### 3. UDS Services Configuration (`uds_services.yaml`)\n- **Common Services**: Available to all ECUs (Read VIN, Diagnostic Session Control, etc.)\n- **ECU-Specific Services**: Engine, Transmission, ABS specific services\n- **Functional Addressing Support**: Services marked for broadcast capability\n- **Response Cycling**: Multiple response options per service\n\n### Configuration Flow Diagram\n\n```mermaid\ngraph TB\n subgraph \"DoIP Server Architecture\"\n subgraph \"Configuration Layer\"\n GW[\"Gateway Configuration<br/>gateway1.yaml<br/>Network Settings<br/>Protocol Config<br/>ECU References<br/>Logging & Security\"]\n \n subgraph \"ECU Configurations\"\n ECU1[\"Engine ECU<br/>0x1000<br/>Target Address<br/>Functional Address<br/>Tester Addresses\"]\n ECU2[\"Transmission ECU<br/>0x1001<br/>Target Address<br/>Functional Address<br/>Tester Addresses\"]\n ECU3[\"ABS ECU<br/>0x1002<br/>Target Address<br/>Functional Address<br/>Tester Addresses\"]\n end\n \n subgraph \"UDS Services\"\n COMMON[\"Common Services<br/>Read VIN<br/>Session Control<br/>Tester Present<br/>Vehicle Type\"]\n SPECIFIC[\"ECU-Specific Services<br/>Engine Services<br/>Transmission Services<br/>ABS Services\"]\n end\n end\n \n subgraph \"DoIP Server Core\"\n UDP[\"UDP Handler<br/>Vehicle Identification<br/>VIN Requests<br/>Entity Status<br/>Power Mode\"]\n TCP[\"TCP Handler<br/>Diagnostic Sessions<br/>Routing Activation<br/>Connection Management<br/>Keep-Alive\"]\n UDS[\"UDS Message Handler<br/>Diagnostic Processing<br/>Service Routing<br/>Response Generation<br/>Error Handling\"]\n end\n \n subgraph \"Communication Layer\"\n PHYSICAL[\"Physical Addressing<br/>Direct ECU Communication<br/>Single ECU Response<br/>Specific Target Address\"]\n FUNCTIONAL[\"Functional Addressing<br/>Broadcast Communication<br/>Multiple ECU Response<br/>Service Filtering<br/>0x1FFF Address\"]\n end\n \n subgraph \"Client Interface\"\n CLIENT[\"DoIP Client<br/>Connection Management<br/>Message Sending<br/>Response Handling\"]\n end\n end\n \n %% Configuration Flow\n GW --> ECU1\n GW --> ECU2\n GW --> ECU3\n GW --> COMMON\n GW --> SPECIFIC\n \n %% Service Assignment\n COMMON --> ECU1\n COMMON --> ECU2\n COMMON --> ECU3\n SPECIFIC --> ECU1\n SPECIFIC --> ECU2\n SPECIFIC --> ECU3\n \n %% Server Processing\n UDP --> UDS\n TCP --> UDS\n UDS --> PHYSICAL\n UDS --> FUNCTIONAL\n \n %% Client Communication\n CLIENT --> UDP\n CLIENT --> TCP\n CLIENT --> PHYSICAL\n CLIENT --> FUNCTIONAL\n \n %% Styling\n classDef configClass fill:#e1f5fe,stroke:#01579b,stroke-width:2px\n classDef serverClass fill:#f3e5f5,stroke:#4a148c,stroke-width:2px\n classDef commClass fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px\n classDef clientClass fill:#fff3e0,stroke:#e65100,stroke-width:2px\n \n class GW,ECU1,ECU2,ECU3,COMMON,SPECIFIC configClass\n class UDP,TCP,UDS serverClass\n class PHYSICAL,FUNCTIONAL commClass\n class CLIENT clientClass\n```\n\n### Communication Flow Diagram\n\n```mermaid\nsequenceDiagram\n participant Client as DoIP Client\n participant UDP as UDP Handler\n participant TCP as TCP Handler\n participant UDS as UDS Handler\n participant ECU1 as Engine ECU\n participant ECU2 as Transmission ECU\n participant ECU3 as ABS ECU\n \n Note over Client,ECU3: Vehicle Identification (UDP)\n Client->>UDP: Vehicle Identification Request\n UDP->>Client: VIN + Entity Status Response\n \n Note over Client,ECU3: Diagnostic Session Setup (TCP)\n Client->>TCP: TCP Connection Request\n TCP->>Client: Connection Established\n Client->>TCP: Routing Activation Request\n TCP->>Client: Routing Activation Response\n \n Note over Client,ECU3: Physical Addressing (Single ECU)\n Client->>TCP: UDS Request (Target: 0x1000)\n TCP->>UDS: Route to Engine ECU\n UDS->>ECU1: Process UDS Service\n ECU1->>UDS: UDS Response\n UDS->>TCP: Forward Response\n TCP->>Client: UDS Response\n \n Note over Client,ECU3: Functional Addressing (Multiple ECUs)\n Client->>TCP: UDS Request (Target: 0x1FFF)\n TCP->>UDS: Route to All ECUs\n UDS->>ECU1: Process UDS Service\n UDS->>ECU2: Process UDS Service\n UDS->>ECU3: Process UDS Service\n ECU1->>UDS: UDS Response (if supported)\n ECU2->>UDS: UDS Response (if supported)\n ECU3->>UDS: UDS Response (if supported)\n UDS->>TCP: Aggregate Responses\n TCP->>Client: Multiple UDS Responses\n \n Note over Client,ECU3: Session Maintenance\n Client->>TCP: Tester Present\n TCP->>UDS: Keep-Alive Processing\n UDS->>ECU1: Update Session Status\n UDS->>ECU2: Update Session Status\n UDS->>ECU3: Update Session Status\n```\n\n### Benefits of Hierarchical Configuration\n\n#### \ud83c\udfaf **Separation of Concerns**\n- **Gateway Configuration**: Network and protocol settings centralized\n- **ECU Configuration**: Individual ECU settings isolated and manageable\n- **Service Configuration**: UDS services organized by category and ECU\n\n#### \ud83d\udd04 **Dynamic Management**\n- **Runtime ECU Loading**: Add/remove ECUs without server restart\n- **Service Isolation**: ECU-specific services don't interfere with others\n- **Easy Scaling**: Add new ECUs by simply adding configuration files\n\n#### \ud83d\udee1\ufe0f **Enhanced Security & Validation**\n- **Per-ECU Address Validation**: Source addresses validated per ECU\n- **Service Authorization**: Only authorized services available per ECU\n- **Configuration Validation**: Comprehensive validation with clear error messages\n\n#### \ud83d\udcc8 **Improved Maintainability**\n- **Modular Structure**: Easy to understand and modify\n- **Clear Ownership**: Each configuration file has a specific purpose\n- **Backward Compatibility**: Legacy configurations still supported\n\n## \ud83d\udd27 Functional Diagnostics\n\n### Overview\n\nThe DoIP server supports **functional diagnostics**, enabling broadcast communication to multiple ECUs using a single request. This powerful feature allows clients to efficiently communicate with multiple ECUs simultaneously.\n\n### Key Concepts\n\n#### Functional Addressing\n- **Functional Address**: Special logical address (default: `0x1FFF`) representing multiple ECUs\n- **Broadcast Communication**: Single request sent to multiple ECUs that support the service\n- **Service Filtering**: Only ECUs supporting the requested UDS service with functional addressing respond\n\n#### Physical vs Functional Addressing\n- **Physical Addressing**: Direct communication with specific ECU using unique logical address\n- **Functional Addressing**: Broadcast communication to multiple ECUs using shared functional address\n\n### Configuration\n\n#### ECU Configuration\nEach ECU configuration includes a functional address:\n\n```yaml\necu:\n name: \"Engine_ECU\"\n target_address: 0x1000\n functional_address: 0x1FFF # Broadcast address\n tester_addresses: [0x0E00, 0x0E01, 0x0E02]\n```\n\n#### UDS Services Configuration\nServices supporting functional addressing are marked:\n\n```yaml\ncommon_services:\n Read_VIN:\n request: \"0x22F190\"\n responses: [\"0x62F1901020011223344556677889AABB\"]\n supports_functional: true # Enables broadcast capability\n```\n\n### Usage Examples\n\n#### Basic Functional Request\n```python\nfrom doip_client.doip_client import DoIPClientWrapper\n\n# Create client\nclient = DoIPClientWrapper(\n server_host=\"127.0.0.1\",\n server_port=13400,\n logical_address=0x0E00,\n target_address=0x1000\n)\n\n# Connect and send functional request\nclient.connect()\nresponse = client.send_functional_read_data_by_identifier(0xF190) # Read VIN\nprint(f\"Response: {response.hex()}\")\nclient.disconnect()\n```\n\n#### Functional vs Physical Comparison\n```python\n# Physical addressing - Engine ECU only\nresponse_physical = client.send_read_data_by_identifier(0xF190)\n\n# Functional addressing - All ECUs that support it\nresponse_functional = client.send_functional_read_data_by_identifier(0xF190)\n```\n\n### Supported Services\n\n#### Common Services (All ECUs)\n- `Read_VIN` - Vehicle Identification Number\n- `Read_Vehicle_Type` - Vehicle Type Information\n- `Diagnostic_Session_Control` - Session management\n- `Tester_Present` - Keep-alive functionality\n\n#### ECU-Specific Services\n- `Engine_Diagnostic_Codes` - Engine trouble codes\n- `Transmission_Diagnostic_Codes` - Transmission trouble codes\n- `ABS_Diagnostic_Codes` - ABS trouble codes\n\n### Testing\n\n```bash\n# Test functional diagnostics\npython scripts/test/test_functional_diagnostics.py\n\n# Run functional demo\npython -c \"from doip_client.doip_client import DoIPClientWrapper; DoIPClientWrapper().run_functional_demo()\"\n```\n\n## \ud83d\udcca Test Status\n\n- **Unit Tests**: 17/17 \u2705 (100%)\n- **Hierarchical Config Tests**: 21/21 \u2705 (100%)\n- **Response Cycling Tests**: 9/9 \u2705 (100%)\n- **Legacy Integration Tests**: 13/13 \u2705 (100%)\n- **Client Extended Tests**: 25/25 \u2705 (100%)\n- **Main Module Tests**: 12/12 \u2705 (100%)\n- **Validate Config Tests**: 15/15 \u2705 (100%)\n- **Debug Client Tests**: 30/30 \u2705 (100%)\n- **Demo Tests**: 5/6 \u2705 (83% - 1 skipped)\n- **Overall**: 185/186 tests passing (99.5% success rate)\n\n## \ud83d\udd27 Development\n\n```bash\n# Run tests\npoetry run pytest tests/ -v\n\n# Run specific test categories\npoetry run pytest tests/test_doip_unit.py -v\npoetry run pytest tests/test_hierarchical_configuration.py -v\npoetry run pytest tests/test_response_cycling.py -v\n```\n\n## \ud83d\udcd6 Documentation\n\nFor detailed documentation, see the [docs/](docs/) directory or start with the [Documentation Index](docs/INDEX.md).\n\n---\n\n*For complete documentation and implementation details, see the [docs/](docs/) directory.*\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "DoIP Server and Client implementation with YAML configuration",
"version": "0.5.2",
"project_urls": {
"Bug Tracker": "https://github.com/Alonso07/doip_server/issues",
"Changelog": "https://github.com/alonso07/doip_server/blob/main/docs/CHANGELOG.md",
"Documentation": "https://github.com/Alonso07/doip_server/tree/main/docs",
"Homepage": "https://github.com/Alonso07/doip_server",
"Repository": "https://github.com/Alonso07/doip_server",
"Source Code": "https://github.com/alonso07/doip_server"
},
"split_keywords": [
"doip",
" diagnostics",
" automotive",
" uds",
" iso13400",
" server",
" client"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "89d043c95f5015b59a048b90bd4ce43fa6d0e050b7cb5a9c7d78722e78c5a894",
"md5": "deeb8f0814174cc3af01fd82e1bbb378",
"sha256": "102c3e8ef0162a12da113c59decfd8662b980128be8ba8ae2fd6eb99318a2b18"
},
"downloads": -1,
"filename": "doip_server-0.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "deeb8f0814174cc3af01fd82e1bbb378",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.15,>=3.10",
"size": 29076,
"upload_time": "2025-10-22T04:20:27",
"upload_time_iso_8601": "2025-10-22T04:20:27.886603Z",
"url": "https://files.pythonhosted.org/packages/89/d0/43c95f5015b59a048b90bd4ce43fa6d0e050b7cb5a9c7d78722e78c5a894/doip_server-0.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e0f9de9a9c377b93a5bcb410923b44ce1b5c95bb10ef1e808f7e1cec8293153a",
"md5": "eedb3b12abd82e53dcb0891f5e251657",
"sha256": "ea68678d1698ba129dc5b3f41c6abc8f744dcb0f126d5b0571afe57c9d83ad80"
},
"downloads": -1,
"filename": "doip_server-0.5.2.tar.gz",
"has_sig": false,
"md5_digest": "eedb3b12abd82e53dcb0891f5e251657",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.15,>=3.10",
"size": 31557,
"upload_time": "2025-10-22T04:20:28",
"upload_time_iso_8601": "2025-10-22T04:20:28.943593Z",
"url": "https://files.pythonhosted.org/packages/e0/f9/de9a9c377b93a5bcb410923b44ce1b5c95bb10ef1e808f7e1cec8293153a/doip_server-0.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-22 04:20:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Alonso07",
"github_project": "doip_server",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "doip-server"
}