SolidSyslog coverage report
Current view: top level - Platform/LwipRaw/Source - SolidSyslogLwipRawAddressPrivate.h (source / functions) Coverage Total Hit
Test: SolidSyslog Lines: 100.0 % 9 9
Test Date: 2026-11-12 23:14:35 Functions: 100.0 % 6 6
Branches: 75.0 % 4 3

             Branch data     Line data    Source code
       1                 :             : /* SPDX-FileCopyrightText: Copyright 2026 Cozens Software Solutions Limited
       2                 :             :  * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 OR LicenseRef-PolyForm-Internal-Use-1.0.0 OR LicenseRef-COSOSO-Commercial
       3                 :             :  */
       4                 :             : 
       5                 :             : #ifndef SOLIDSYSLOGLWIPRAWADDRESSPRIVATE_H
       6                 :             : #define SOLIDSYSLOGLWIPRAWADDRESSPRIVATE_H
       7                 :             : 
       8                 :             : #include <stdbool.h>
       9                 :             : #include <stdint.h>
      10                 :             : 
      11                 :             : #include "SolidSyslogError.h"
      12                 :             : #include "SolidSyslogLwipRawAddressErrors.h"
      13                 :             : #include "SolidSyslogPrival.h"
      14                 :             : #include "lwip/ip_addr.h"
      15                 :             : 
      16                 :             : struct SolidSyslogAddress;
      17                 :             : 
      18                 :             : /* POD payload behind the opaque SolidSyslogAddress handle. lwIP carries
      19                 :             :  * the destination IP and port as independent arguments to udp_sendto /
      20                 :             :  * tcp_connect, so we store them as independent fields and let consumers
      21                 :             :  * read/write them directly via -> on the downcast pointer. No per-field
      22                 :             :  * accessors - there is no invariant to enforce. */
      23                 :             : struct SolidSyslogLwipRawAddress
      24                 :             : {
      25                 :             :     ip_addr_t Ip;
      26                 :             :     u16_t Port;
      27                 :             : };
      28                 :             : 
      29                 :             : void SolidSyslogLwipRawAddress_Initialise(struct SolidSyslogAddress* base);
      30                 :             : void SolidSyslogLwipRawAddress_Cleanup(struct SolidSyslogAddress* base);
      31                 :             : 
      32                 :         311 : static inline struct SolidSyslogLwipRawAddress* SolidSyslogLwipRawAddress_As(struct SolidSyslogAddress* base)
      33                 :             : {
      34                 :         311 :     return (struct SolidSyslogLwipRawAddress*) base;
      35                 :             : }
      36                 :             : 
      37                 :         100 : static inline const struct SolidSyslogLwipRawAddress* SolidSyslogLwipRawAddress_AsConst(
      38                 :             :     const struct SolidSyslogAddress* base
      39                 :             : )
      40                 :             : {
      41                 :         100 :     return (const struct SolidSyslogLwipRawAddress*) base;
      42                 :             : }
      43                 :             : 
      44                 :             : /* The family the pack's transports send to. A dual-stack lwIP parses and
      45                 :             :  * resolves IPv6 too; on an IPv4-only one IP_IS_V4 is the constant 1 and the
      46                 :             :  * address goes unread. */
      47                 :          31 : static inline bool LwipRawAddress_IsIpv4(const ip_addr_t* address)
      48                 :             : {
      49                 :             :     (void) address;
      50   [ +  -  +  + ]:          31 :     return (IP_IS_V4(address) != 0);
      51                 :             : }
      52                 :             : 
      53                 :           9 : static inline void LwipRawAddress_Report(
      54                 :             :     enum SolidSyslogSeverity severity,
      55                 :             :     uint16_t category,
      56                 :             :     enum SolidSyslogAddressErrors code
      57                 :             : )
      58                 :             : {
      59                 :           9 :     SolidSyslog_Error(severity, &SolidSyslogLwipRawAddressErrorSource, category, (int32_t) code);
      60                 :           9 : }
      61                 :             : 
      62                 :             : #endif /* SOLIDSYSLOGLWIPRAWADDRESSPRIVATE_H */
        

Generated by: LCOV version 2.0-1