LCOV - code coverage report
Current view: top level - AP_Networking - AP_Networking_Backend.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 2 3 66.7 %
Date: 2026-09-09 11:02:08 Functions: 2 3 66.7 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "AP_Networking_Config.h"
       4             : 
       5             : #if AP_NETWORKING_ENABLED
       6             : 
       7             : #include "AP_Networking.h"
       8             : 
       9             : class AP_Networking;
      10             : 
      11             : #ifndef AP_NETWORKING_MAX_ROUTES
      12             : #define AP_NETWORKING_MAX_ROUTES 4
      13             : #endif
      14             : 
      15             : class AP_Networking_Backend
      16             : {
      17             : public:
      18             :     friend class AP_Networking;
      19             : 
      20           8 :     AP_Networking_Backend(AP_Networking &_frontend) : frontend(_frontend) {}
      21             : 
      22             :     /* Do not allow copies */
      23             :     CLASS_NO_COPY(AP_Networking_Backend);
      24             : 
      25             :     virtual bool init() = 0;
      26        5589 :     virtual void update() {};
      27             : 
      28             :     // add a new route for an interface
      29             :     // Returns true if the route is added or the route already exists
      30             :     bool add_route(uint8_t iface_idx, uint32_t dest_ip, uint8_t mask_len);
      31             : 
      32             :     // hook for custom routes
      33           0 :     virtual struct netif *routing_hook(uint32_t dest) { return nullptr; }
      34             : 
      35             : #if AP_NETWORKING_CAPTURE_ENABLED
      36             :     /*
      37             :       write a header for the start of a new capture packet
      38             :       a capture semaphore should be taken before the header is output
      39             :       and held for the whole packet
      40             :      */
      41             :     void capture_header(int fd, uint32_t len);
      42             : #endif
      43             : 
      44             : protected:
      45             :     AP_Networking &frontend;
      46             : 
      47             :     struct {
      48             :         uint32_t ip;
      49             :         uint32_t nm;
      50             :         uint32_t gw;
      51             :         uint32_t announce_ms;
      52             :         uint8_t macaddr[6];
      53             :         uint32_t last_change_ms;
      54             :     } activeSettings;
      55             : 
      56             :     struct {
      57             :         bool enabled;
      58             :         uint8_t iface_idx;
      59             :         uint32_t dest_ip;
      60             :         uint32_t netmask;
      61             :     } routes[AP_NETWORKING_MAX_ROUTES];
      62             : };
      63             : 
      64             : #endif // AP_NETWORKING_ENABLED

Generated by: LCOV version 1.14