TraceLoggingSocketAddress macro (traceloggingprovider.h)

TraceLogging wrapper macro that adds a field with a socket address to the event.

Syntax

void TraceLoggingSocketAddress(
  [in]            pValue,
  [in]            cbValue,
  [in, optional]  __VA_ARGS__
);

Parameters

[in] pValue

A pointer to a sockaddr structure.

[in] cbValue

The size, in bytes, of the value pointed to by the pValue parameter.

Note

The amount of data needed for a sockaddr field varies depending on the type of address. If the data is stored in a union variable, be sure to set the cbValue parameter to the size of the correct union member (or to the size of the union) to avoid truncating the data.

[in, optional] __VA_ARGS__

Optional name, description, and tags parameters for the field definition.

TraceLoggingSocketAddress can be specified with 2, 3, 4, or 5 parameters. If a parameter is not specified, a default will be used. For example, TraceLoggingSocketAddress(&x.sockAddr, sizeof(x.sockAddr)) is equivalent to TraceLoggingSocketAddress(&x.sockAddr, sizeof(x.sockAddr), "&x.sockAddr", "", 0).

  • [in, optional] name

    The name to use for the event field. If provided, the name parameter must be a string literal (not a variable) and must not contain any '\0' characters. If not provided, the event field name will be based on pValue.

  • [in, optional] description

    The description of the event field's value. If provided, the description parameter must be a string literal and will be included in the PDB.

  • [in, optional] tags

    A compile-time constant integer value. The low 28 bits of the value will be included in the field's metadata. The semantics of this value are defined by the event consumer. During event processing, this value can be retrieved from the EVENT_PROPERTY_INFO Tags field.

Return value

None

Remarks

TraceLoggingSocketAddress(pValue, cbValue, ...) can be used as a parameter to an invocation of a TraceLoggingWrite macro. Each TraceLoggingSocketAddress parameter adds one field to the event.

The value may be any Windows sockaddr type, e.g. SOCKADDR, SOCKADDR_IN, SOCKADDR_IN6, SOCKADDR_STORAGE, etc. The event will record the raw binary data and the data size. The event decoder will use the sa_family field to determine the actual type of the socket address.

Note

Not all decoders will support all sockaddr family types. If an unsupported sockaddr is encountered, the decoder might decode the field as raw binary data instead of formatting it as an address.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header traceloggingprovider.h

See also

TraceLoggingWrite

TraceLogging wrapper macros