> This page is for version 1.4.0 (Latest) (default).
> For other versions, use one of these documentation indexes:
> - 1.4.0 (Latest) (default): https://docs.nvidia.com/halos/outside-in-safety/1.4.0/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/halos/outside-in-safety/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/halos/outside-in-safety/_mcp/server.

# NvPSDGatewayContract.hpp

> Generated reference for NvPSDGatewayContract.hpp: The gateway's contract with an SDM: subscribable and mandatory event types, the request-ID range and the records the gateway synthesises. C++.

The gateway's contract with an SDM: subscribable and mandatory event types, the request-ID range and the records the gateway synthesises. C++.

Part of the NvPSD Gateway interface. Generated from the header published in `safety-core/`, release 1.3-26.07.5. The development packages install it in `/opt/nvidia/psf/include`.

```c
#include "NvPSDGatewayContract.hpp"
```

## Functions

### NvPSDGatewayAddMandatoryEventTypes

```c
static inline void NvPSDGatewayAddMandatoryEventTypes(std::unordered_set< EventType > &types);
```

### NvPSDGatewayIsAllowedHealthEventType

```c
static inline bool NvPSDGatewayIsAllowedHealthEventType(uint32_t raw);
```

### NvPSDGatewayBuildRegisteredEventSet

```c
static inline bool NvPSDGatewayBuildRegisteredEventSet(const uint32_t *rawEventTypes, uint8_t count, std::unordered_set< EventType > *outTypes);
```

### NvPSDGatewayClassifyRegr

```c
static inline uint8_t NvPSDGatewayClassifyRegr(const char *buf, size_t n, std::unordered_set< EventType > *outTypes);
```

### NvPSDGatewayIsStatusNoopOnlyRequest

```c
static inline bool NvPSDGatewayIsStatusNoopOnlyRequest(const DecisionRequest &req);
```

### NvPSDGatewayShouldSendDecisionRequest

```c
static inline bool NvPSDGatewayShouldSendDecisionRequest(bool sendFullRequest, uint8_t eventCount, OperationalMode pssMode);
```

### NvPSDGatewayDecisionPacketSendResult

```c
static inline NvPSDGatewayPacketSendResult NvPSDGatewayDecisionPacketSendResult(ssize_t sentBytes);
```

### NvPSDGatewayBuildDecisionRequestPacket

```c
static inline bool NvPSDGatewayBuildDecisionRequestPacket(const DecisionRequest &req, uint64_t gatewayEpoch, uint32_t gatewayTxSeq, NvPSDGatewayDecisionRequestPacket *outPacket);
```

### NvPSDGatewayRequestIdIsSequenceTracked

```c
static inline bool NvPSDGatewayRequestIdIsSequenceTracked(uint32_t requestId);
```

### NvPSDGatewayObservePssRequestId

```c
static inline NvPSDGatewayPssRequestObservation NvPSDGatewayObservePssRequestId(NvPSDGatewayPssSequenceState *state, uint32_t requestId);
```

### NvPSDGatewayShouldForwardObservedPssRequest

```c
static inline bool NvPSDGatewayShouldForwardObservedPssRequest(NvPSDGatewayPssRequestObservation observation);
```

### NvPSDGatewayBuildPssSequenceGapSwFailRequest

```c
static inline bool NvPSDGatewayBuildPssSequenceGapSwFailRequest(const DecisionRequest &current, DecisionRequest *outRequest);
```

### NvPSDGatewayBuildInvalidPssRequestIdSwFailRequest

```c
static inline bool NvPSDGatewayBuildInvalidPssRequestIdSwFailRequest(const DecisionRequest &current, DecisionRequest *outRequest);
```

### NvPSDGatewayRecoveryRecordOwed

```c
static inline bool NvPSDGatewayRecoveryRecordOwed(uint64_t recoveryOwedGen);
```

### NvPSDGatewayRecoveryDebtAfterSend

```c
static inline uint64_t NvPSDGatewayRecoveryDebtAfterSend(uint64_t owedNow, uint64_t sentFor, bool sent);
```

### NvPSDGatewayBuildPssCommRecoveredRequest

```c
static inline bool NvPSDGatewayBuildPssCommRecoveredRequest(const DecisionRequest &current, DecisionRequest *outRequest);
```

### NvPSDGatewayBuildPssErrorSwFailRequest

```c
static inline bool NvPSDGatewayBuildPssErrorSwFailRequest(const DecisionRequest &current, DecisionRequest *outRequest);
```

## Types

### NvPSDGatewayRegrRateLimiter

```c
class NvPSDGatewayRegrRateLimiter
```

| Field           | Declaration                                      | Description |
| --------------- | ------------------------------------------------ | ----------- |
| `maxPerWindow_` | `uint32_t maxPerWindow_`                         |             |
| `windowMs_`     | `uint32_t windowMs_`                             |             |
| `entries_`      | `std::unordered_map< uint32_t, Entry > entries_` |             |

### NvPSDGatewayRegrRateLimiter::Entry

```c
struct NvPSDGatewayRegrRateLimiter::Entry
```

| Field           | Declaration              | Description |
| --------------- | ------------------------ | ----------- |
| `windowStartMs` | `uint64_t windowStartMs` |             |
| `count`         | `uint32_t count`         |             |
| `notified`      | `bool notified`          |             |

### NvPSDGatewayPssSequenceState

```c
struct NvPSDGatewayPssSequenceState
```

| Field                | Declaration                   | Description |
| -------------------- | ----------------------------- | ----------- |
| `initialized`        | `bool initialized`            |             |
| `lastValidRequestId` | `uint32_t lastValidRequestId` |             |

### NvPSDGatewayRegrAdmission

```c
enum NvPSDGatewayRegrAdmission
```

| Value           | Initializer | Description |
| --------------- | ----------- | ----------- |
| `ADMIT`         |             |             |
| `REFUSE_NOTIFY` |             |             |
| `REFUSE_SILENT` |             |             |

### NvPSDGatewayPacketSendResult

```c
enum NvPSDGatewayPacketSendResult
```

| Value               | Initializer | Description |
| ------------------- | ----------- | ----------- |
| `SENT`              | `0U`        |             |
| `FAILED_SYSCALL`    |             |             |
| `FAILED_SHORT_SEND` |             |             |

### NvPSDGatewayPssRequestObservation

```c
enum NvPSDGatewayPssRequestObservation
```

| Value                | Initializer | Description |
| -------------------- | ----------- | ----------- |
| `ACCEPT`             | `0U`        |             |
| `GAP`                |             |             |
| `DUPLICATE_OR_STALE` |             |             |
| `INVALID`            |             |             |

## Constants

| Name                                        | Declaration                                                             | Description |
| ------------------------------------------- | ----------------------------------------------------------------------- | ----------- |
| `NVPSD_GATEWAY_MAX_EVENT_TYPES_PER_CLIENT`  | `constexpr uint8_t NVPSD_GATEWAY_MAX_EVENT_TYPES_PER_CLIENT = 32U`      |             |
| `NVPSD_GATEWAY_PSS_REQUEST_ID_MIN`          | `constexpr uint32_t NVPSD_GATEWAY_PSS_REQUEST_ID_MIN = 1U`              |             |
| `NVPSD_GATEWAY_PSS_REQUEST_ID_MAX`          | `constexpr uint32_t NVPSD_GATEWAY_PSS_REQUEST_ID_MAX = UINT32_MAX - 1U` |             |
| `NVPSD_GATEWAY_REGR_MAX_PER_WINDOW_DEFAULT` | `constexpr uint32_t NVPSD_GATEWAY_REGR_MAX_PER_WINDOW_DEFAULT = 4U`     |             |
| `NVPSD_GATEWAY_REGR_MAX_PER_WINDOW_MIN`     | `constexpr uint32_t NVPSD_GATEWAY_REGR_MAX_PER_WINDOW_MIN = 1U`         |             |
| `NVPSD_GATEWAY_REGR_MAX_PER_WINDOW_MAX`     | `constexpr uint32_t NVPSD_GATEWAY_REGR_MAX_PER_WINDOW_MAX = 64U`        |             |
| `NVPSD_GATEWAY_REGR_WINDOW_MS_DEFAULT`      | `constexpr uint32_t NVPSD_GATEWAY_REGR_WINDOW_MS_DEFAULT = 10000U`      |             |
| `NVPSD_GATEWAY_REGR_WINDOW_MS_MIN`          | `constexpr uint32_t NVPSD_GATEWAY_REGR_WINDOW_MS_MIN = 1000U`           |             |
| `NVPSD_GATEWAY_REGR_WINDOW_MS_MAX`          | `constexpr uint32_t NVPSD_GATEWAY_REGR_WINDOW_MS_MAX = 600000U`         |             |