<QGrpcInterceptor> - Interceptor types | Qt GRPC | Qt 6.12.0
Description: The <QGrpcInterceptor> header file provides the basic interceptor types.
Keywords: header

- Qt 6.12
- Qt GRPC
- <QGrpcInterceptor> - Interceptor types
- Qt 6.12.0 Reference Documentation

# <QGrpcInterceptor> - Interceptor types

The <QGrpcInterceptor> header file provides the basic interceptor types. More...

Header: | `#include <QGrpcInterceptor>`
Since: | Qt 6.11

## Types

`(since 6.11)` flags | InterceptorCapabilities
`(since 6.11)` enum class | InterceptorCapability { Start, InitialMetadata, MessageReceived, WriteMessage, WritesDone, …, Cancel }

## Detailed Description

Qt GRPC provides various types that are commonly grouped in the `<QtGrpcInterceptor>` header file.

For an introduction to the interception mechanism and how interceptor interfaces participate in the lifecycle of an RPC, see the Qt GRPC Interceptors Overview.

Qt GRPC provides the following interceptor interfaces as hook points in the RPC lifecycle:

Interface | Hook Point | Direction | Can Modify
--- | --- | --- | ---
QGrpcStartInterceptor | Before the RPC is initiated | Outbound | Initial message object, call options
QGrpcWriteMessageInterceptor | Before an outgoing message is written | Outbound | Message object
QGrpcWritesDoneInterceptor | When the client indicates writes are done | Outbound | —
QGrpcCancelInterceptor | When the RPC is cancelled | Outbound | —
QGrpcInitialMetadataInterceptor | When initial metadata is received | Inbound | Metadata
QGrpcMessageReceivedInterceptor | When a message payload is received | Inbound | Serialized message data
QGrpcTrailingMetadataInterceptor | When trailing metadata is received | Inbound | Metadata
QGrpcFinishedInterceptor | When the RPC completes | Inbound | Final status

#### Interceptor mechanism

The following classes and pages form the Qt GRPC interceptor mechanism:

- QGrpcCancelInterceptor
- QGrpcFinishedInterceptor
- QGrpcInitialMetadataInterceptor
- QGrpcInterceptionContext
- QGrpcInterceptorChain
- QGrpcMessageReceivedInterceptor
- QGrpcStartInterceptor
- QGrpcTrailingMetadataInterceptor
- QGrpcWriteMessageInterceptor
- QGrpcWritesDoneInterceptor
- Qt GRPC Interceptors Overview
- QGrpcStartInterceptor::Continuation
- InterceptorCapability
- InterceptorCapabilities

## Type Documentation

### `[since 6.11]` enum class InterceptorCapability
`[since 6.11]` flags InterceptorCapabilities

Specifies interception hook points supported by an interceptor.

Qt GRPC uses InterceptorCapability values to describe which interception hook points an interceptor provides.

A single interceptor class can implement multiple interceptor interfaces (for example, QGrpcStartInterceptor and QGrpcFinishedInterceptor) and therefore support multiple capabilities.

Constant | Value | Description
--- | --- | ---
`InterceptorCapability::Start` | `0x01` | The interceptor implements QGrpcStartInterceptor.
`InterceptorCapability::InitialMetadata` | `0x02` | The interceptor implements QGrpcInitialMetadataInterceptor.
`InterceptorCapability::MessageReceived` | `0x04` | The interceptor implements QGrpcMessageReceivedInterceptor.
`InterceptorCapability::WriteMessage` | `0x08` | The interceptor implements QGrpcWriteMessageInterceptor.
`InterceptorCapability::WritesDone` | `0x10` | The interceptor implements QGrpcWritesDoneInterceptor.
`InterceptorCapability::TrailingMetadata` | `0x20` | The interceptor implements QGrpcTrailingMetadataInterceptor.
`InterceptorCapability::Finished` | `0x40` | The interceptor implements QGrpcFinishedInterceptor.
`InterceptorCapability::Cancel` | `0x80` | The interceptor implements QGrpcCancelInterceptor.

This enum was introduced in Qt 6.11.

The InterceptorCapabilities type is a typedef for QFlags<InterceptorCapability>. It stores an OR combination of InterceptorCapability values.