DeterministicESPAsyncWebServer
v6.28.0
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
goose.h
Go to the documentation of this file.
1
// Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2
// SPDX-License-Identifier: AGPL-3.0-or-later
3
4
/**
5
* @file goose.h
6
* @brief IEC 61850 GOOSE publisher codec (DETWS_ENABLE_GOOSE).
7
*
8
* GOOSE (Generic Object Oriented Substation Event) is the fast raw-L2 multicast publish IEC 61850 uses
9
* for protection trips. A GOOSE frame is an Ethernet frame (ethertype 0x88B8, see services/rawl2) with
10
* an 8-octet GOOSE header (APPID, length, two reserved) followed by the BER-encoded `IECGoosePdu`:
11
*
12
* 61 len { 80 gocbRef 81 timeAllowedToLive 82 datSet 83 goID 84 t(UtcTime,8) 85 stNum
13
* 86 sqNum 87 simulation(BOOL) 88 confRev 89 ndsCom(BOOL) 8A numDatSetEntries AB allData }
14
*
15
* This builds the control PDU (all fields above) with `allData` supplied as a caller-encoded BER blob
16
* (a SEQUENCE of Data elements), then wraps it in the GOOSE header + Ethernet frame. Pure, zero heap,
17
* no stdlib, host-testable; the raw-L2 transmit (`esp_eth_transmit`) is the device step.
18
*/
19
20
#ifndef DETERMINISTICESPASYNCWEBSERVER_GOOSE_H
21
#define DETERMINISTICESPASYNCWEBSERVER_GOOSE_H
22
23
#include "
ServerConfig.h
"
24
#include <stddef.h>
25
#include <stdint.h>
26
27
#if DETWS_ENABLE_GOOSE
28
29
/** @brief The GOOSE control fields (strings are borrowed, not copied). */
30
struct
DetwsGoose
31
{
32
const
char
*gocb_ref;
///< the GOOSE control-block reference.
33
uint32_t time_allowed_to_live;
///< ms the subscriber should keep this valid.
34
const
char
*dat_set;
///< the dataset reference.
35
const
char
*go_id;
///< the GOOSE id.
36
const
uint8_t *t;
///< 8-octet UtcTime (seconds-since-epoch + fraction + quality).
37
uint32_t st_num;
///< state number (bumped on a data change).
38
uint32_t sq_num;
///< sequence number (bumped on each resend).
39
bool
simulation;
///< test/simulation flag.
40
uint32_t conf_rev;
///< configuration revision.
41
bool
nds_com;
///< needs-commissioning flag.
42
uint32_t num_entries;
///< number of dataset entries in allData.
43
const
uint8_t *all_data;
///< pre-encoded BER SEQUENCE-of-Data body (contents of the AB field).
44
size_t
all_data_len;
45
};
46
47
/**
48
* @brief Build the BER IECGoosePdu (the `61 ...` structure) into @p out. @return length, or 0 on overflow.
49
*/
50
size_t
detws_goose_pdu(
const
DetwsGoose *g, uint8_t *out,
size_t
cap);
51
52
/**
53
* @brief Build a full GOOSE Ethernet frame: [dst][src][88B8][APPID len rsvd rsvd][IECGoosePdu].
54
* @param appid the GOOSE APPID.
55
* @return the frame length, or 0 on overflow. Requires DETWS_ENABLE_RAWL2 for the Ethernet framing.
56
*/
57
size_t
detws_goose_frame(
const
uint8_t *dst,
const
uint8_t *src, uint16_t appid,
const
DetwsGoose *g, uint8_t *out,
58
size_t
cap);
59
60
#endif
// DETWS_ENABLE_GOOSE
61
#endif
// DETERMINISTICESPASYNCWEBSERVER_GOOSE_H
ServerConfig.h
User-facing configuration for DeterministicESPAsyncWebServer.
src
services
goose
goose.h
Generated by
1.9.8