ggz.h(3)
πΈ NAME πΈ
okay so this is ggz.h(3) from LibGGZ β the header line says ggz.h(3) on both sides, and the NAME line is literally just ggz.h -. No cap, that's the whole name section. It's giving "mysterious header energy" and we're obsessed. π
β¨ SYNOPSIS β¨
#include <sys/types.h>
Bestie, that's the only include in the synopsis, and then we get into defines, typedefs, and enums. Let's go. π¦
π Defines π
LIBGGZ_VERSION_MAJORβ0. That's the major version, periodt.LIBGGZ_VERSION_MINORβ0. Minor version, also0.LIBGGZ_VERSION_MICROβ11. Micro version,11.LIBGGZ_VERSION_IFACEβ'3:1:1'. Interface version, exactly as written.ggz__attribute(att)β Lets you use GCC's'attribute'macro for debugging without the hassle. This one is literally a helper for that._GGZFUNCTION_β__FUNCTION__. That's the function-name macro.GGZ_MEM_DEBUGβ'ggz_mem'. The debugging type for memory debugging.ggz_malloc(size)β Macro that handles memory allocation. The exact define is:
#define ggz_malloc(size) _ggz_malloc(size, _GGZFUNCTION_ ' in '
__FILE__, __LINE__)
ggz_realloc(mem, size)β Macro that resizes memory you already allocated. Exact define:
#define ggz_realloc(mem, size) _ggz_realloc(mem, size, _GGZFUNCTION_ '
in ' __FILE__, __LINE__)
ggz_free(mem)β Macro that frees memory you allocated earlier. Exact define:
#define ggz_free(mem) _ggz_free(mem, _GGZFUNCTION_ ' in ' __FILE__,
__LINE__)
ggz_strdup(string)β Macro that duplicates a string. Exact define:
#define ggz_strdup(string) _ggz_strdup(string, _GGZFUNCTION_ ' in '
__FILE__, __LINE__)
GGZ_CONF_DEBUGβ'ggz_conf'. The debugging type for config-file debugging.GGZ_LIST_REPLACE_DUPSβ0x00. When inserting, overwrite duplicate values.GGZ_LIST_ALLOW_DUPSβ0x01. Let duplicate data entries exist in the list.GGZ_SOCKET_DEBUGβ'socket'. Theggz_debugdebugging type for Easysock debugging.
π«Ά Typedefs π«Ά
typedef int(* ggzEntryCompare )(const void *a, const void *b)β This is the function type for comparing two items in aGGZList, bestie.typedef void *(* ggzEntryCreate )(void *data)β Function type that makes a copy of a data item so it can be inserted into aGGZList.typedef void(* ggzEntryDestroy )(void *data)β Function type that destroys an entry in aGGZList.typedef _GGZListEntry GGZListEntryβ One single entry inside aGGZList, periodt.typedef _GGZList GGZListβ A simple doubly-linked list. It's giving linked-list realness.typedef _GGZList GGZStackβ Stacks, but implemented simply usingGGZList.typedef _GGZXMLElement GGZXMLElementβ An object that represents one single XML element.typedef void(* GGZDebugHandlerFunc )(int priority, const char *msg)β A callback function that handles debugging output.typedef _GGZFile GGZFileβ A structure used internally byggz_read_line().typedef void(* ggzIOError )(const char *msg, const GGZIOType type, const int fd, const GGZDataType data)β An error function type. That's it, that's the vibe.typedef void(* ggzIOExit )(int status)β An exit function type, slay.
π Enumerations π
enum GGZConfType { GGZ_CONF_RDONLY = ((unsigned char) 0x01), GGZ_CONF_RDWR = ((unsigned char) 0x02), GGZ_CONF_CREATE = ((unsigned char) 0x04) }β This enum sets the mode for opening a configuration file.enum GGZCheckType { GGZ_CHECK_NONE = 0x00, GGZ_CHECK_MEM = 0x01 }β Which memory checks are we doing? This enum tells you.enum GGZIOType { GGZ_IO_CREATE, GGZ_IO_READ, GGZ_IO_WRITE, GGZ_IO_ALLOCATE }β An error type for the GGZ socket functions.enum GGZDataType { GGZ_DATA_NONE, GGZ_DATA_CHAR, GGZ_DATA_INT, GGZ_DATA_STRING, GGZ_DATA_FD }β A data type for the GGZ socket function error handler.enum GGZSockType { GGZ_SOCK_SERVER, GGZ_SOCK_CLIENT }β A socket type, no cap.enum GGZTLSType { GGZ_TLS_CLIENT, GGZ_TLS_SERVER }β TLS operation mode, periodt.enum GGZTLSVerificationType { GGZ_TLS_VERIFY_NONE, GGZ_TLS_VERIFY_PEER }β TLS verification type.
π FUNCTIONS π
Okay bestie, this is the whole roster. Every single one. Buckle up, it's a long scroll but we're getting through it together π«Ά
void * _ggz_malloc (const size_t size, const char *tag, int line)β the function that actually performs the memory allocation.sizeis the vibe (how much),tagandlineare the receipts.void * _ggz_realloc (const void *ptr, const size_t size, const char *tag, int line)β the one that performs memory reallocation. glow-up for your existing block β¨int _ggz_free (const void *ptr, const char *tag, int line)β frees allocated memory. say bye πchar * _ggz_strdup (const char *ptr, const char *tag, int line)β copies a string. twin, but make it memory.int ggz_memory_check (void)β checks the memory you allocated against the memory you freed and shows you any discrepancies. it's giving detective energy π and honestly it will clock you.
void ggz_conf_cleanup (void)β closes all open configuration files. every last one, no stragglers.void ggz_conf_close (int handle)β closes one configuration file. just the one behindhandle.int ggz_conf_parse (const char *path, const GGZConfType options)β opens a configuration file atpathand parses the variables so the access functions can come get them later.int ggz_conf_commit (int handle)β commits any changed variables to the configuration file. make it official πΎint ggz_conf_write_string (int handle, const char *section, const char *key, const char *value)β writes a string value to asectionandkeyin an open configuration file.int ggz_conf_write_int (int handle, const char *section, const char *key, int value)β same energy, but the value is an integer.int ggz_conf_write_list (int handle, const char *section, const char *key, int argc, char **argv)β writes a whole list of string values (argcof them, hanging out inargv) to a section and key in an open config file.char * ggz_conf_read_string (int handle, const char *section, const char *key, const char *def)β reads a string value out of an open configuration file.defis your fallback bestie if the key ghosts you.int ggz_conf_read_int (int handle, const char *section, const char *key, int def)β reads an integer value from an open config file, withdefas the backup plan.int ggz_conf_read_list (int handle, const char *section, const char *key, int *argcp, char ***argvp)β reads a list of string values out of an open config file, dropping the count inargcpand the goods inargvp.int ggz_conf_remove_section (int handle, const char *section)β removes an entire section and every single one of its associated keys from a configuration file. it's gone. poof. πint ggz_conf_remove_key (int handle, const char *section, const char *key)β removes a single key from a configuration file. surgical. precise. iconic.int ggz_conf_get_sections (int handle, int *argcp, char ***argvp)β returns a list of all the sections in a config file.int ggz_conf_get_keys (int handle, const char *section, int *argcp, char ***argvp)β returns a list of all the keys inside one section of a config file.
GGZList * ggz_list_create (ggzEntryCompare compare_func, ggzEntryCreate create_func, ggzEntryDestroy destroy_func, int options)β creates a brand newGGZList, with your compare, create and destroy functions plus someoptions.int ggz_list_insert (GGZList *list, void *data)β inserts data into a list.GGZListEntry * ggz_list_head (GGZList *list)β gets the first node of a list. the main character πGGZListEntry * ggz_list_tail (GGZList *list)β gets the last node of a list.GGZListEntry * ggz_list_next (GGZListEntry *entry)β gets the next node of a list.GGZListEntry * ggz_list_prev (GGZListEntry *entry)β gets the previous node of a list.void * ggz_list_get_data (GGZListEntry *entry)β retrieves the data stored in a list entry.GGZListEntry * ggz_list_search (GGZList *list, void *data)β searches the list for a specified data item.GGZListEntry * ggz_list_search_alt (GGZList *list, void *data, ggzEntryCompare compare_func)β same search, but you hand it thecompare_functo do it with.void ggz_list_delete_entry (GGZList *list, GGZListEntry *entry)β removes an entry from a list, calling a destructor if one is registered.void ggz_list_free (GGZList *list)β frees all resources associated with a list.int ggz_list_count (GGZList *list)β gets the length of the list. counting era π’int ggz_list_compare_str (void *a, void *b)β compares two character strings.void * ggz_list_create_str (void *data)β copies a character string.void ggz_list_destroy_str (void *data)β frees a character string.
GGZStack * ggz_stack_new (void)β creates a new stack.void ggz_stack_push (GGZStack *stack, void *data)β pushes a data item onto the top of the stack.void * ggz_stack_pop (GGZStack *stack)β pops the top item off of the stack.void * ggz_stack_top (GGZStack *stack)β gets the top item on the stack without popping it. just a lil peek, no commitment πvoid ggz_stack_free (GGZStack *stack)β frees the stack.
GGZXMLElement * ggz_xmlelement_new (const char *tag, const char *const *attrs, void(*process)(), void(*free)())β creates a newGGZXMLElement.void ggz_xmlelement_init (GGZXMLElement *element, const char *tag, const char *const *attrs, void(*process)(), void(*free)())β initializes aGGZXMLElement.void ggz_xmlelement_set_data (GGZXMLElement *element, void *data)β sets ancillary data on aGGZXMLElementobject.const char * ggz_xmlelement_get_tag (GGZXMLElement *element)β gets an XML element's name.const char * ggz_xmlelement_get_attr (GGZXMLElement *element, const char *attr)β gets the value of an attribute on an XML element.void * ggz_xmlelement_get_data (GGZXMLElement *element)β gets the user-supplied data associated with an XML element.char * ggz_xmlelement_get_text (GGZXMLElement *element)β gets an XML element's content text.void ggz_xmlelement_add_text (GGZXMLElement *element, const char *text, int len)β appends a string (of lengthlen) to the element's content text.void ggz_xmlelement_free (GGZXMLElement *element)β frees the memory associated with an XML element.
void ggz_debug_init (const char **types, const char *file)β initializes and configures debugging for the program.GGZDebugHandlerFunc ggz_debug_set_func (GGZDebugHandlerFunc func)β sets the debug handler function.void ggz_debug_enable (const char *type)β enables a specific type of debugging.void ggz_debug_disable (const char *type)β disables a specific type of debugging. silence, bestie π€«void ggz_debug (const char *type, const char *fmt,...)β logs a debugging message. (the manpage renderer lowkey fumbled this entry and spat outggz__attribute((format(printfas a stray fragment β that's literally what's printed here, so here it is.)void void ggz_log (const char *type, const char *fmt,...)β logs a notice message. same deal, mangled fragment included:ggz__attribute((format(printfvoid void void ggz_error_sys (const char *fmt,...)β logs a syscall error. mangled fragment included:ggz__attribute((format(printfvoid void void void ggz_error_sys_exit (const char *fmt,...)β logs a fatal syscall error. mangled fragment included:ggz__attribute((format(printfvoid void void void ggz__attribute ((noreturn))β this entry has no description attached to it in the original. it's just vibes and void keywords. leaving it exactly as found π«‘void ggz_error_msg (const char *fmt,...) ggz__attribute((format(printfβ logs an error message.void void ggz_error_msg_exit (const char *fmt,...)β logs a fatal error message. mangled fragment included:ggz__attribute((format(printfvoid ggz_debug_cleanup (GGZCheckType check)β cleans up debugging state and prepares for exit.checkis aGGZCheckType.
char * ggz_xml_escape (const char *str)β escapes XML characters in a text string.char * ggz_xml_unescape (const char *str)β restores escaped XML characters back into a text string. undoing the whole look β¨
GGZFile * ggz_get_file_struct (int fdes)β sets up a file structure so you can use it withggz_read_line().char * ggz_read_line (GGZFile *file)β reads a line of arbitrary length from a file. no length drama, we're flexible.void ggz_free_file_struct (GGZFile *file)β deallocates a file structure that was allocated viaggz_get_file_struct().
int ggz_strcmp (const char *s1, const char *s2)β string comparison function that is safe with NULLs. yes, even those strings π«Άint ggz_strcasecmp (const char *s1, const char *s2)β case-insensitive string comparison function that is safe with NULLs. The function returns an integer less than, equal to, or greater than zero ifs1is found, respectively, to be less than, to match, or be greater thans2.
int ggz_set_io_error_func (ggzIOError func)β sets the ggz/easysock error handling function.ggzIOError ggz_remove_io_error_func (void)β removes the ggz/easysock error handling function.int ggz_set_io_exit_func (ggzIOExit func)β sets the ggz/easysock exit function.ggzIOExit ggz_remove_io_exit_func (void)β removes the ggz/easysock exit function.unsigned int ggz_get_io_alloc_limit (void)β gets libggz's limit on memory allocation.unsigned int ggz_set_io_alloc_limit (const unsigned int limit)β sets libggz's limit on memory allocation.limitis the number, and it'sconst.
int ggz_init_network (void)β initializes the network. let's get connected πint ggz_make_socket (const GGZSockType type, const unsigned short port, const char *server)β makes a socket connection.int ggz_make_socket_or_die (const GGZSockType type, const unsigned short port, const char *server)β makes a socket connection, and exits on error. hence the name, bestie πint ggz_make_unix_socket (const GGZSockType type, const char *name)β connects to a unix domain socket.int ggz_make_unix_socket_or_die (const GGZSockType type, const char *name)β connects to a unix domain socket, exiting on error.
int ggz_write_char (const int sock, const char data)β writes a character value to the given socket.void ggz_write_char_or_die (const int sock, const char data)β writes a character value to the given socket, exiting on error.int ggz_read_char (const int sock, char *data)β reads a character value from the given socket.void ggz_read_char_or_die (const int sock, char *data)β reads a character value from the given socket, exiting on error.int ggz_write_int (const int sock, const int data)β writes an integer to the socket in network byte order.void ggz_write_int_or_die (const int sock, const int data)β writes an integer to the socket, exiting on error.int ggz_read_int (const int sock, int *data)β reads an integer from the socket in network byte order.void ggz_read_int_or_die (const int sock, int *data)β reads an integer from the socket, exiting on error.int ggz_write_string (const int sock, const char *data)β writes a string to the given socket.void ggz_write_string_or_die (const int sock, const char *data)β writes a string to the given socket, exiting on error.int ggz_va_write_string (const int sock, const char *fmt,...)β writes aprintf-style formatted string to the given socket. mangled fragment included:ggz__attribute((format(printfint void ggz_va_write_string_or_die (const int sock, const char *fmt,...)β writes a formatted string to the socket, exiting on error. mangled fragment included:ggz__attribute((format(printfint void int ggz_read_string (const int sock, char *data, const unsigned int len)β reads a string from the given socket.void ggz_read_string_or_die (const int sock, char *data, const unsigned int len)
Read a string from the given socket, exiting on error.
int ggz_read_string_alloc (const int sock, char **data)β Read and allocate a string from the given socket. πvoid ggz_read_string_alloc_or_die (const int sock, char **data)β Read and allocate string from the given socket, exiting on error. πint ggz_write_fd (const int sock, int sendfd)β Write a file descriptor to the given (local) socket. π«Άint ggz_read_fd (const int sock, int *recvfd)β Read a file descriptor from the given (local) socket. π₯int ggz_writen (const int sock, const void *vdata, size_t n)β Write a sequence of bytes to the socket. β¨int ggz_readn (const int sock, void *data, size_t n)β Read a sequence of bytes from the socket. πΈhash_t ggz_hash_create (const char *algo, const char *text)β Create a hash over a text. πhash_t ggz_hmac_create (const char *algo, const char *text, const char *secret)β Create a HMAC hash over a text. πchar * ggz_base64_encode (const char *text, int length)β Encodes text to base64. πchar * ggz_base64_decode (const char *text, int length)β Decodes text from base64. π¦void ggz_tls_init (const char *certfile, const char *keyfile, const char *password)β Initialize TLS support on the server side. πint ggz_tls_support_query (void)β Check TLS support. πint ggz_tls_enable_fd (int fdes, GGZTLSType whoami, GGZTLSVerificationType verify)β Enable TLS for a file descriptor. βint ggz_tls_disable_fd (int fdes)β Disable TLS for a file descriptor. πsize_t ggz_tls_write (int fd, void *ptr, size_t n)β Write some bytes to a secured file descriptor. πsize_t ggz_tls_read (int fd, void *ptr, size_t n)β Read from a secured file descriptor. π
π Detailed Description π
Author: Brent M. Hendricks Date: Fri Nov 2 23:32:17 2001 Id: Id.RS 4 ggz.h,v 1.59 2005/05/21 10:19:22 josef Exp
Header file for ggz components lib. π
Copyright (C) 2001 Brent Hendricks.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
β¨ Define Documentation β¨
#define ggz__attribute(att)β Allow easy use of GCC's 'attribute' macro for debugging. π
Under gcc, we use the __attribute__ macro to check variadic arguments, for instance to printf-style functions. Other compilers may be able to do something similar, but this is generally unnecessary since its only real purpose is to give warning messages when the developer compiles the code. π
π¦ Author π¦
Generated automatically by Doxygen for LibGGZ from the source code. π€
Peace out bestie! This page was brought to you by LibGGZ version 0.0.11, dated 21 May 2005 β and it's literally ggz.h(3). Stay slay! πβ¨π
π¦ where this page comes from
- fedora 43: ggz-base-libs-devel 0.99.5-41.fc43 Β· LicenseRef-Callaway-LGPLv2+ AND GPL-2.0-or-later
- fedora 43: ggz-base-libs-devel 0.99.5-41.fc43 Β· LicenseRef-Callaway-LGPLv2+ AND GPL-2.0-or-later
- nixos 26.05: ggz-base-libs 0.99.5
- nixpkgs unstable: ggz-base-libs 0.99.5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms