ggz.h(3)

πŸ“¦ version 0.99.5, in fedora 43, nixos 26.05, nixpkgs unstable

🌸 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, also 0.
  • 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'. The ggz_debug debugging type for Easysock debugging.

🫢 Typedefs 🫢

  • typedef int(* ggzEntryCompare )(const void *a, const void *b) β€” This is the function type for comparing two items in a GGZList, bestie.
  • typedef void *(* ggzEntryCreate )(void *data) β€” Function type that makes a copy of a data item so it can be inserted into a GGZList.
  • typedef void(* ggzEntryDestroy )(void *data) β€” Function type that destroys an entry in a GGZList.
  • typedef _GGZListEntry GGZListEntry β€” One single entry inside a GGZList, periodt.
  • typedef _GGZList GGZList β€” A simple doubly-linked list. It's giving linked-list realness.
  • typedef _GGZList GGZStack β€” Stacks, but implemented simply using GGZList.
  • 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 by ggz_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. size is the vibe (how much), tag and line are 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 behind handle.
  • int ggz_conf_parse (const char *path, const GGZConfType options) β€” opens a configuration file at path and 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 a section and key in 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 (argc of them, hanging out in argv) 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. def is 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, with def as 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 in argcp and the goods in argvp.
  • 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 new GGZList, with your compare, create and destroy functions plus some options.
  • 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 the compare_func to 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 new GGZXMLElement.
  • void ggz_xmlelement_init (GGZXMLElement *element, const char *tag, const char *const *attrs, void(*process)(), void(*free)()) β€” initializes a GGZXMLElement.
  • void ggz_xmlelement_set_data (GGZXMLElement *element, void *data) β€” sets ancillary data on a GGZXMLElement object.
  • 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 length len) 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 out ggz__attribute((format(printf as 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(printf
  • void void void ggz_error_sys (const char *fmt,...) β€” logs a syscall error. mangled fragment included: ggz__attribute((format(printf
  • void void void void ggz_error_sys_exit (const char *fmt,...) β€” logs a fatal syscall error. mangled fragment included: ggz__attribute((format(printf
  • void 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(printf
  • void ggz_debug_cleanup (GGZCheckType check) β€” cleans up debugging state and prepares for exit. check is a GGZCheckType.

  • 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 with ggz_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 via ggz_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 if s1 is found, respectively, to be less than, to match, or be greater than s2.

  • 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. limit is the number, and it's const.

  • 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 a printf-style formatted string to the given socket. mangled fragment included: ggz__attribute((format(printf
  • int 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(printf
  • int 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