LBER_SOCKBUF(3)
π LBER_SOCKBUF(3) π
okay so bestie, welcome to LBER_SOCKBUF(3) β the Library Functions Manual page for OpenLDAP LBER I/O infrastructure. β¨ This one is all about the low-level I/O glow-up, and we're gonna get into it, no cap. π«Ά
πΈ NAME πΈ
ber_sockbuf_alloc, ber_sockbuf_free, ber_sockbuf_ctrl, ber_sockbuf_add_io, ber_sockbuf_remove_io, Sockbuf_IO β OpenLDAP LBER I/O infrastructure. π
π«Ά LIBRARY π«Ά
OpenLDAP LBER (liblber, -llber). π
β¨ SYNOPSIS β¨
#include <lber.h>
Sockbuf *ber_sockbuf_alloc( void );
void ber_sockbuf_free(Sockbuf *sb);
int ber_sockbuf_ctrl(Sockbuf *sb, int opt, void *arg);
int ber_sockbuf_add_io(Sockbuf *sb, Sockbuf_IO *sbio, int layer, void
*arg);
int ber_sockbuf_remove_io(Sockbuf *sb, Sockbuf_IO *sbio, int layer);
typedef struct sockbuf_io_desc {
int sbiod_level;
Sockbuf *sbiod_sb;
Sockbuf_IO *sbiod_io;
void *sbiod_pvt;
struct sockbuf_io_desc *sbiod_next;
} Sockbuf_IO_Desc;
typedef struct sockbuf_io {
int (*sbi_setup)(Sockbuf_IO_Desc *sbiod, void *arg);
int (*sbi_remove)(Sockbuf_IO_Desc *sbiod);
int (*sbi_ctrl)(Sockbuf_IO_Desc *sbiod, int opt, void *arg);
ber_slen_t (*sbi_read)(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len);
ber_slen_t (*sbi_write)(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len);
int (*sbi_close)(Sockbuf_IO_Desc *sbiod);
} Sockbuf_IO;
π DESCRIPTION π
These routines are the low-level I/O glue for the Lightweight BER library. They get called implicitly by the other libraries, and usually you do not need to call them directly from applications. π The I/O framework is modularized, and new transport layers can be supported by appropriately defining a Sockbuf_IO structure and installing it onto an existing Sockbuf. π§
Sockbuf structures are allocated and freed by ber_sockbuf_alloc() and ber_sockbuf_free(), respectively. The ber_sockbuf_ctrl() function is used to get and set options related to a Sockbuf or to a specific I/O layer of the Sockbuf. The ber_sockbuf_add_io() and ber_sockbuf_remove_io() functions are used to add and remove specific I/O layers on a Sockbuf. β¨
π Options for ber_sockbuf_ctrl() π
Options for ber_sockbuf_ctrl() include:
LBER_SB_OPT_HAS_IOβ takes aSockbuf_IO *argument and returns1if the given handler is installed on theSockbuf, otherwise returns0. πLBER_SB_OPT_GET_FDβ retrieves the file descriptor associated to theSockbuf;argmust be aber_socket_t *. The return value will be1if a valid descriptor was present,-1otherwise. π¦LBER_SB_OPT_SET_FDβ sets the file descriptor of theSockbufto the descriptor pointed to byarg;argmust be aber_socket_t *. The return value will always be1. β¨LBER_SB_OPT_SET_NONBLOCKβ toggles the non-blocking state of the file descriptor associated to theSockbuf.argshould beNULLto disable and non-NULLto enable the non-blocking state. The return value will be1for success,-1otherwise. πLBER_SB_OPT_DRAINβ flush (read and discard) all available input on theSockbuf. The return value will be1. πLBER_SB_OPT_NEEDS_READβ returns non-zero if input is waiting to be read. πLBER_SB_OPT_NEEDS_WRITEβ returns non-zero if theSockbufis ready to be written. πLBER_SB_OPT_GET_MAX_INCOMINGβ returns the maximum allowed size of an incoming message;argmust be aber_len_t *. The return value will be1. πLBER_SB_OPT_SET_MAX_INCOMINGβ sets the maximum allowed size of an incoming message;argmust be aber_len_t *. The return value will be1. π§
Options not in this list will be passed down to each Sockbuf_IO handler in turn until one of them processes it. If the option is not handled, ber_sockbuf_ctrl() will return 0. π
Multiple Sockbuf_IO handlers can be stacked in multiple layers to provide various functionality. Currently defined layers include:
π¦ Layers π¦
LBER_SBIOD_LEVEL_PROVIDERβ the lowest layer, talking directly to a network. πLBER_SBIOD_LEVEL_TRANSPORTβ an intermediate layer. πLBER_SBIOD_LEVEL_APPLICATIONβ a higher layer. π
π Sockbuf_IO handlers π
Currently defined Sockbuf_IO handlers in liblber include:
ber_sockbuf_io_tcpβ the default stream-oriented provider. πber_sockbuf_io_fdβ a stream-oriented provider for local IPC sockets. πber_sockbuf_io_dgramβ a datagram-oriented provider. This handler is only present if theliblberlibrary was built withLDAP_CONNECTIONLESSdefined. π¦ber_sockbuf_io_readaheadβ a buffering layer, usually used with a datagram provider to hide the datagram semantics from upper layers. π§ber_sockbuf_io_debugβ a generic handler that outputs hex dumps of all traffic. This handler may be inserted multiple times at arbitrary layers to show the flow of data between other handlers. π
π Additional handlers in libldap π
Additional handlers may be present in libldap if support for them was enabled:
ldap_pvt_sockbuf_io_saslβ an application layer handler for SASL encoding/decoding. πsb_tls_sbioβ a transport layer handler for SSL/TLS encoding/decoding. Note that this handler is private to the library and is not exposed in the API. π
The provided handlers are all instantiated implicitly by libldap, and applications generally will not need to directly manipulate them. π«Ά
π SEE ALSO π
lber-decode(3), lber-encode(3), lber-types(3), ldap_get_option(3)
π ACKNOWLEDGEMENTS π
OpenLDAP Software is developed and maintained by The OpenLDAP Project (<http://www.openldap.org/>). OpenLDAP Software is derived from the University of Michigan LDAP 3.3 Release. π«Ά
okay that's the whole page, bestie! π This one's from OpenLDAP 2.6.16, dated 2026/10/21, and the manual tag is LBER_SOCKBUF(3) β periodt. πβ¨
π¦ where this page comes from
- fedora 44: openldap-devel 2.6.16-1.fc44 Β· OLDAP-2.8
- fedora 44: openldap-devel 2.6.16-1.fc44 Β· OLDAP-2.8
- Copyright 1998-2026 The OpenLDAP Foundation All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms