LIBPDEL(3)

NAME
libpdel - multi-purpose C library for embedded applications

LIBRARY
PDEL Library (libpdel, -lpdel)

DESCRIPTION
The Packet Design Embedded Library (PDEL) is a C library containing an assorted collection of code useful for developing embedded applications:

-   C data structure run-time introspection library: structs(3)
    -   Support for automated conversion to/from XML
    -   Pre-defined types for most C data structures
-   Threaded HTTP client/server library: http_server(3)
    -   SSL support
    -   User-definable C "servlets": http_servlet(3)
    -   Several pre-defined servlets
    -   Support for XML/HTTP and XML-RPC: http_xml(3)
-   PPP stack library (FreeBSD only): pdel_ppp(3)
    -   Netgraph(4) based for kernel data packet handling
    -   Servers for PPTP and L2TP
-   Application configuration framework: app_config(3)
-   Heap memory accounting and sanity checking: typed_mem(3)
-   File template library: tmpl(3)
-   Routines to configure networking interfaces, ARP table, and routing table (FreeBSD only): if_util(3), route_msg(3), uroute(3)
-   Logging library: alog(3)
    -   Automated storage into circular file: logfile(3)
    -   syslog(3) compatibile
-   Generic TCP server: tcp_server(3)
-   Generic hash table implementation: ghash(3)
-   Generic balanced tree implementation: gtree(3)
-   FILE * enhancements:
    -   Generic data "filters": filter_fopen(3)
    -   MIME boundary input streams: boundary_fopen(3)
    -   Fixed length input streams: count_fopen(3)
    -   String buffer input/output streams: string_fp(3)
    -   Timeout streams: timeout_fdopen(3)
    -   SSL streams: ssl_fp(3)
-   Base-64 encoding/decoding: base64(3)
-   Events and actions with automated locking: paction(3), pevent(3)
-   Generalized per-thread variables: tinfo(3)
-   Message ports: mesg_port(3)
-   Digital signature creation/verification: rsa_util_sign(3)
-   Filesystem mounting/unmounting (FreeBSD only): fs_mount(3)
-   String quoting/parsing: string_enquote(3)

For more details, see the individual man pages referenced above.

REQUIREMENTS
Unlike Java, libraries written in C cannot presume a commonly accepted standard for handling certain issues like threading and heap allocation. Therefore, libpdel makes certain assumptions which user code must follow.

First, all heap memory in libpdel is allocated through the typed_mem(3) typed memory system. Participation by user code in this system is optional, but it must be done, or not done, consistently.

The libpdel library assumes that pthread(3) is used for user-level threading. In general, libpdel objects are not safe to be called simultaneously from separate threads, or re-entrantly from the same thread, except where explicitly documented. For example, the application must guarantee serialized access to a ghash(3) hash table; the hash table itself does not provide this protection.

Some threads that can end up running user code are subject to cancellation at any cancellation point. For example, a thread created by an http_server(3) object to handle an HTTP request will be canceled if the remote client closes the TCP connection. This implies that any user code which could be running under such a thread must register thread cleanup hooks to release any resources such as heap memory, mutexes, etc., should the thread be canceled.

All libpdel functions are cancel-safe if the thread has cancel type PTHREAD_CANCEL_DEFERRED, except where noted.

Because libpdel in turn depends on other libraries, programs linking with libpdel must also link with these libraries:

-   SSL: -lssl
-   Cryptography: -lcrypto
-   Netgraph (FreeBSD only): -lnetgraph
-   RADIUS (FreeBSD only): -lradius
-   Expat: -L/usr/local/lib -lexpat
-   Pthreads: -pthread (-lpthread on Linux)

Expat is available as FreeBSD port "textproc/expat2" (see ports(7)).

SEE ALSO
alog(3), app_config(3), base64(3), boundary_fopen(3), count_fopen(3), filter_fopen(3), fs_mount(3), ghash(3), gtree(3), http_client(3), http_server(3), if_util(3), logfile(3), paction(3), pdel_ppp(3), pevent(3), pthread(3), route_msg(3), rsa_util_sign(3), string_enquote(3), string_fp(3), structs(3), tcp_server(3), timeout_fdopen(3), tinfo(3), tmpl(3), typed_mem(3), uroute(3) The Open Group, Single UNIX Specification, Version 2, Threads, http://www.opengroup.org/onlinepubs/7908799/xsh/threads.html. James Clark, Expat XML Parser, http://sourceforge.net/projects/expat/.

HISTORY
The PDEL library was developed at Packet Design, LLC. http://www.packetdesign.com/

AUTHORS
Archie Cobbs <archie@freebsd.org>

BUGS
Some functionality is only supported under FreeBSD.

Please report bugs to the author.