# voip-co-uk/sftf architecture

> Architecture diagram of the GitHub repository voip-co-uk/sftf, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/voip-co-uk/sftf
- Repository: https://github.com/voip-co-uk/sftf

## Overview

##### Main Components

a) Core Testing Framework Layer:
- SFTF.py (main entry point) at the top
- TestCase.py and TestResult.py as core testing components
- To UserAgentBasicTestSuite directory containing all test cases

b) Protocol Handling Layer:
- SIP Message Processing:
- SipMessage.py as the base
- SipRequest.py and SipReply.py as specializations
- Transaction.py for SIP transaction management

- Header Field Handlers (HFH directory):
- Header field handlers (Via.py, To.py, From.py, etc.)
- HeaderFieldHandler.py as the base class

c) Network and Event Handling Layer:
- NetworkEventHandler.py
- EventHandler.py
- FileEventHandler.py
- XMLEventHandler.py
- HttpServer.py
- RtpStream.py and RtpEvent.py for media handling

d) Authentication Components:
- DigestAuthentication.py
- Related header handlers (Authorization.py, ProxyAuthentication.py)

##### Relationships and Data Flow

- Test execution flow from SFTF.py → TestCase.py → Individual test cases
- SIP message flow through the protocol handling layer
- Event propagation through the event handling system
- Authentication flow when applicable

##### Important Details

- Notes about key configuration points (Config.py)
- Callouts for important utility classes (Helper.py, Log.py)
- Body parser components (BodyParser directory)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Test Framework Layer"
        SFTF["SFTF.py (Main Entry)"]:::core
        TC["TestCase.py"]:::core
        TR["TestResult.py"]:::core
        TS["Test Suites"]:::core
    end

    subgraph "Protocol Handling Layer"
        SM["SipMessage.py"]:::protocol
        SR["SipRequest.py"]:::protocol
        SP["SipReply.py"]:::protocol
        TM["Transaction.py"]:::protocol
        DG["Dialog.py"]:::protocol

        subgraph "Header Field Handlers"
            HFH["Header Field Handlers"]:::protocol
            AUTH_H["Authorization.py"]:::auth
            PAUTH_H["Proxyauthenticate.py"]:::auth
            WAUTH_H["Wwwauthenticate.py"]:::auth
        end
    end

    subgraph "Network and Event Layer"
        EH["EventHandler.py"]:::event
        NEH["NetworkEventHandler.py"]:::event
        FEH["FileEventHandler.py"]:::event
        XEH["XMLEventHandler.py"]:::event
        SE["SipEvent.py"]:::event
        HS["HttpServer.py"]:::event
    end

    subgraph "Media Handling"
        RS["RtpStream.py"]:::media
        RE["RtpEvent.py"]:::media
    end

    subgraph "Authentication"
        DA["DigestAuthentication.py"]:::auth
    end

    subgraph "Body Parsing"
        SDP["applicationsdp.py"]:::parser
        TXT["textplain.py"]:::parser
    end

    subgraph "Utilities"
        CF["Config.py"]:::util
        LG["Log.py"]:::util
        HP["Helper.py"]:::util
    end

    %% Core Framework Relationships
    SFTF --> TC
    SFTF --> TR
    SFTF --> TS
    TC --> SM
    
    %% Protocol Layer Relationships
    SM --> SR
    SM --> SP
    SM --> TM
    TM --> DG
    SM --> HFH
    
    %% Event System Relationships
    EH --> NEH
    EH --> FEH
    EH --> XEH
    EH --> SE
    
    %% Authentication Flow
    DA --> AUTH_H
    DA --> PAUTH_H
    DA --> WAUTH_H
    
    %% Media Handling
    NEH --> RS
    RS --> RE
    
    %% Utility Usage
    SFTF --> CF
    SFTF --> LG
    SFTF --> HP
    
    %% Click Events
    click SFTF "https://github.com/VoIP-co-uk/sftf/blob/master/SFTF.py"
    click TC "https://github.com/VoIP-co-uk/sftf/blob/master/TestCase.py"
    click TR "https://github.com/VoIP-co-uk/sftf/blob/master/TestResult.py"
    click TS "https://github.com/VoIP-co-uk/sftf/tree/master/UserAgentBasicTestSuite"
    click SM "https://github.com/VoIP-co-uk/sftf/blob/master/SipMessage.py"
    click SR "https://github.com/VoIP-co-uk/sftf/blob/master/SipRequest.py"
    click SP "https://github.com/VoIP-co-uk/sftf/blob/master/SipReply.py"
    click TM "https://github.com/VoIP-co-uk/sftf/blob/master/Transaction.py"
    click DG "https://github.com/VoIP-co-uk/sftf/blob/master/Dialog.py"
    click HFH "https://github.com/VoIP-co-uk/sftf/tree/master/HFH"
    click AUTH_H "https://github.com/VoIP-co-uk/sftf/blob/master/HFH/Authorization.py"
    click PAUTH_H "https://github.com/VoIP-co-uk/sftf/blob/master/HFH/Proxyauthenticate.py"
    click WAUTH_H "https://github.com/VoIP-co-uk/sftf/blob/master/HFH/Wwwauthenticate.py"
    click EH "https://github.com/VoIP-co-uk/sftf/blob/master/EventHandler.py"
    click NEH "https://github.com/VoIP-co-uk/sftf/blob/master/NetworkEventHandler.py"
    click FEH "https://github.com/VoIP-co-uk/sftf/blob/master/FileEventHandler.py"
    click XEH "https://github.com/VoIP-co-uk/sftf/blob/master/XMLEventHandler.py"
    click SE "https://github.com/VoIP-co-uk/sftf/blob/master/SipEvent.py"
    click HS "https://github.com/VoIP-co-uk/sftf/blob/master/HttpServer.py"
    click RS "https://github.com/VoIP-co-uk/sftf/blob/master/RtpStream.py"
    click RE "https://github.com/VoIP-co-uk/sftf/blob/master/RtpEvent.py"
    click DA "https://github.com/VoIP-co-uk/sftf/blob/master/DigestAuthentication.py"
    click SDP "https://github.com/VoIP-co-uk/sftf/blob/master/BodyParser/applicationsdp.py"
    click TXT "https://github.com/VoIP-co-uk/sftf/blob/master/BodyParser/textplain.py"
    click CF "https://github.com/VoIP-co-uk/sftf/blob/master/Config.py"
    click LG "https://github.com/VoIP-co-uk/sftf/blob/master/Log.py"
    click HP "https://github.com/VoIP-co-uk/sftf/blob/master/Helper.py"

    %% Styling
    classDef core fill:#a8d1f0,stroke:#333,stroke-width:2px
    classDef protocol fill:#90EE90,stroke:#333,stroke-width:2px
    classDef event fill:#FFE5B4,stroke:#333,stroke-width:2px
    classDef auth fill:#FFB6C1,stroke:#333,stroke-width:2px
    classDef media fill:#E6E6FA,stroke:#333,stroke-width:2px
    classDef parser fill:#F0E68C,stroke:#333,stroke-width:2px
    classDef util fill:#D3D3D3,stroke:#333,stroke-width:2px
```
