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 : #include "SolidSyslogNullAtomicCounter.h"
6 :
7 : #include <stdint.h>
8 :
9 : #include "SolidSyslogAtomicCounterDefinition.h"
10 :
11 : static uint32_t NullAtomicCounter_Increment(struct SolidSyslogAtomicCounter* base);
12 :
13 242 : struct SolidSyslogAtomicCounter* SolidSyslogNullAtomicCounter_Get(void)
14 : {
15 : static struct SolidSyslogAtomicCounter instance = {.Increment = NullAtomicCounter_Increment};
16 242 : return &instance;
17 : }
18 :
19 : /* Returns 1U unconditionally. RFC 5424 section 7.3.1 requires sequenceIds in
20 : * [1, 2^31 - 1] and never 0; 1U is indistinguishable from the post-power-on
21 : * or post-wrap state, which is the safest fallback when an integrator's
22 : * AtomicCounter pool is exhausted. */
23 6 : static uint32_t NullAtomicCounter_Increment(struct SolidSyslogAtomicCounter* base)
24 : {
25 : (void) base;
26 6 : return 1U;
27 : }
|