---
name: "au_socket_type"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/au_bsm_to_socket_type"
---

# au\_socket\_type(3)

convert between BSM and local socket types

Part of [au\_bsm\_to\_socket\_type(3)](/au_bsm_to_socket_type/3.md).

## NAME

**au\_bsm\_to\_socket\_type**, **au\_socket\_type\_to\_bsm** – convert between BSM and local socket types

## LIBRARY

library “libbsm”

## SYNOPSIS

**#include \<bsm/libbsm.h\>**

*int*\

**au\_bsm\_to\_socket\_type**(*u\_short bsm\_socket\_type*, *int \*local\_socket\_typep*);

*u\_short*\

**au\_socket\_type\_to\_bsm**(*int local\_socket\_type*);

## DESCRIPTION

These interfaces may be used to convert between the local and BSM socket types. The **au\_bsm\_to\_socket\_type**() function accepts a BSM socket type, *bsm\_socket\_type*, and converts it to a local socket type, such as those passed to [socket(2)](/socket/2.md), that will be stored in the integer pointed to by *local\_socket\_typep* if successful. This call will fail if the BSM socket type cannot be mapped into a local socket type, which may occur if the socket token was generated on another operating system.

**au\_socket\_type\_to\_bsm**() function accepts a local socket type, and returns the BSM socket type for it. This call cannot fail, and instead returns a BSM socket type indicating to a later decoder that the socket type could not be encoded.

## RETURN VALUES

On success, **au\_bsm\_to\_socket\_type**() returns 0 and a converted socket type; on failure, it returns -1 but does not set [errno(2)](/errno/2.md).

On success, **au\_strerror**() returns a pointer to an error string; on failure it will return NULL.

## SEE ALSO

[au\_bsm\_to\_domain(3)](/au_bsm_to_domain/3.md), [au\_domain\_to\_bsm(3)](/au_domain_to_bsm/3.md), [au\_to\_socket\_ex(3)](/au_to_socket_ex/3.md), [libbsm(3)](/libbsm/3.md)

## HISTORY

**au\_bsm\_to\_socket\_type**() and **au\_socket\_type\_to\_bsm**() were introduced in OpenBSM 1.1.

## AUTHORS

These functions were implemented by Robert Watson under contract to Apple Inc.

The Basic Security Module (BSM) interface to audit records and audit event stream format were defined by Sun Microsystems.
