GPL About Home
    Home
    About
    Papers
    Projects
      Mercury
      Jupiter
      Saturn
      Pluto
      Chaos / CosMos
      Agent Smith
      Discontent
      libMidnightCode
      CubeCart
      ATS
      Picview
      SpamStats
      Babel
      Toad
      HAC Rack
      Tank
      Clock
      TGXF

Other Project
Project libMidnightCode  (Once Written, Twice Linked)

Objective:
Subroutine Collective :: To provide a single base resource of subroutines that will facilitate faster development time and greater application quality across the common core components of all Midnight Code projects.

Project output should include a collective of C (ANSI/C99) libraries and the supporting (usage) documentation.

Description:
Despite the massive amount of source code that has been developed to support various Midnight Code projects over the years, many programs share a small group of common functions. These functions include; displaying logos, displaying copyright and license information, displaying status information, executing processes, taking command-line switches and reading configuration files.

Unfortunately, these common functions have not shared common code.

When projects start as insignificant and have a small part to play in a larger process, liberties are often taken in the development process to ensure that only the necessary time is spent attempting to achieve an application objective. However, as programs are deemed useful, they are extended in functionality and capacity, as their function in that process becomes significant. It is in this growth environment that poor code can become a substantial operational risk. It is also this type of environment that will see one piece of functionality implemented and re-implemented in slightly different ways in similar applications, over time - often with initial or early implementations being left without the improvements of later incarnations.

This growth creep is the cause of varying degrees of quality within key functions across the Midnight Code project range.

This project will ensure that all future programs utilising common functions will be implemented from a known-good source base. It will also ensure that problems identified and corrected for one project will be reflected in all, via recompilation against an updated libmidnightcode.

The current function set offered by libmidnightcode, includes;

Base64 Encoder/Decoder Library
- base64_encode
- base64_decode

Bootp/DHCP (Client) Library
- bootp_write_option
- bootp_read_option
- bootp_open
- bootp_write
- bootp_read
- bootp

Camera (Frame/Video) Library
- camera_open
- camera_close
- camera_read
- camera_activate
- camera_deactivate
- camera_format
- camera_fps
- camera_buffers
- camera_verifycontrol
- camera_action_backlightcompensation
- camera_action_powerlinefrequency
- camera_action_panrelative
- camera_action_tiltrelative
- camera_action_resetpantilt
- camera_transcode
- camera_probe
- camera_list

Casting Protocol Library
- cast_read
- cast_write
- cast_seed
- cast_cache_empty
- cast_cache_trim
- cast_cache_merge
- cast_membrane
- cast_send
- cast_receive
- cast_handler_inbound
- cast_handler_outbound
- cast_initialise
- cast_shutdown

Checksum Library
- checksum_endian
- checksum_crc32
- checksum_crc32_seeded

Configuration Library
- config_parseline
- config_read
- config_read_file
- config_write
- config_write_file
- config_del_structure
- config_get_sections
- config_add_pair
- config_get_pair
- config_destroy

Disk Library
- disk_flush
- disk_sg_query
- disk_probe_scsi
- disk_probe_hdio
- disk_probe_cdrom
- disk_trayopen
- disk_trayclose
- disk_capacity
- disk_probe
- disk_list
- disk_bytype
- disk_only
- disk_to_config
- disk_from_config

Filter (Network) Library
- filter_bycommand
- filter

Global Position System Library
- gps_open
- gps_close
- gps_receive
- gps_unfix
- gps_handler
- gps_initialise
- gps_shutdown

HTML Library
- html_urltype
- html_urlproto
- html_urlbase
- html_tagbit
- html_parse

Init (System Initialiser) Library
- init_process
- init_sysctl
- init_config_load
- init_config_retrieve
- init_hardware
- init_peripherals
- init_networking
- init_mountfs
- init_nic_default
- init_nic_lo
- init_usbmedia
- init_cdmedia
- init_boot

Interface (Network) Library
- interface_writehosts
- interface_up
- interface_down
- interface_configure
- interface_add
- interface_probe
- interface_list
- interface_support
- interface_byindex
- interface_byname
- interface_only
- interface_to_config
- interface_from_config
- interface_transfer
- interface_smartdefault
- interface_smartdefaults
- interface_marry
- interface_isalias
- interface_vendor
- interface_handler
- interface_initialise
- interface_shutdown

Internet Protocol (IP) Library
- ip_cidrtomask
- ip_masktocidr
- ip_classmask
- ip_broadcast
- ip_network
- ip_isinnet
- ip_isinnet_s
- ip_isvalid_s
- ip_isspecial
- ip_isprivate
- ip_ismulticast
- ip_cmp
- ip_tohex
- ip_tohex_s
- ip_fromhex
- ip_fromhex_s

License Library
- license_buffer
- license
- license_get_nodeid
- license_get_permid

Logo Library
- logo_buffer
- logo

Logical Volume Management Library
- lvm_pvcreate
- lvm_vgcreate
- lvm_vgactivate
- lvm_vgremove
- lvm_vgextend
- lvm_vgreduce
- lvm_lvcreate
- lvm_lvremove
- lvm_bycommand
- lvm

Parser Library
- parse_any
- parse_any_offset
- parse_any_len
- parse_strstr
- parse_ascii
- parse_yesno
- parse_size
- parse_trim
- parse_toupper
- parse_tolower
- parse_replace_char
- parse_extmatch
- parse_exttype
- parse_strtourl
- parse_strtoarg
- parse_strtovar
- parse_vartostr
- parse_unserialize
- parse_serialize

PCMCIA Library
- pcmcia_exists

Process Execution Library
- process_daemonise
- process_execute
- process_execute_construct
- process_parser
- process
- process_sysctl

Random Number (PRNG) Library
- random_randmax
- random_seed
- random_ent_complex
- random_gen_basic
- random_gen_complex
- random_init

Resolver (DNS) Library
- resolve_check
- resolve_writeconf
- resolve_to_config
- resolve_from_config

Routing (Network) Library
- route_scope
- route_listrecv
- route_listadd
- route_list
- route_default
- route_add
- route_to_config
- route_from_config

Servo IO Library
- servo_flush
- servo_move
- servo_probe
- servo_list

Socket (Network) Library
- socket_open
- socket_toggle_broadcast
- socket_toggle_reuse
- socket_validate
- socket_read
- socket_read_block
- socket_write
- socket_write_block
- socket_close
- socket_closeshut
- socket_accept
- socket_getchild
- socket_membrane_size_est
- socket_membrane
- socket_control_dispatch
- socket_control_processor
- socket_receive_extract_bit
- socket_receive_extract
- socket_receive_seek
- socket_receive_chunk
- socket_receive_processor
- socket_handler
- socket_initialise
- socket_shutdown

Status Library
- status_text
- status_flag

Switch (Command Line) Library
- switch_usage
- switch_process

System Log (Client) Library
- syslog_facilitycheck
- syslog_severitycheck
- syslog_priority
- syslog_log

Terminal (Console) Library
- terminal_console_open
- terminal_console_close
- terminal_console_usurp
- terminal_virtual_open
- terminal_virtuals_open
- terminal_environment
- terminal_properties

Trivial File Transfer Library
- tftp_get

Web Interface Library
- webint_membrane
- webint_buffer
- webint

As at August 2006, the socket library is complete and working well. The release of libMidnightCode version 1.1 includes performance metrics of 10.93Mbytes/sec for type RAW sockets, and 4.23Mbytes/sec for type MIDNIGHTCODE sockets. The socket library is one of the big-three - and it will allow both Tyd negotiation for Project CHAOS and HTML interface connectivity for Projects Saturn and Pluto.

As at October 2006, the init library is complete. A proof of concept platform (10 Mbyte Linux distribution, 2.6 kernel based) has been used to boot Project Saturn hardware, from a USB key, to a running multi-user state. The latest version (1.2) of libMidnightCode compiles natively to a shared library, allowing the libMidnightCode applications to be separated into their own archive.

As at March 2007, the webint (web interface) library framework is in place, but its not yet usable as an interactive administration interface. This version also sees improvements in the socket library, and the addition of Video4Linux UVC camera support. Tested against the Logitec Sphere (Orbit) 2006, the camera library supports pan and tilt motor control; integration has been specifically designed to support the new ATS project.

As at June 2007, the Casting protocol has been implemented, allowing for the future creation of a very simple, yet significantly more robust, Tyd replacement for CHAOS - dreamt of since the socket library code of August 2006. This release (libMidnightCode version 1.4) also includes a new Servo motor control library and GPS library (for gpsd interaction), amongst a number of minor tweaks such as a child socket finder, safe list iteration, etc ad nausea.

As at July 2007, the Bootp/DHCP protocol has been implemented, facilitating integrated interface address discovery. This removes the last dependency for the boot prompt options for CHAOS - thus the reference platform no longer has help for these options. A Syslog client library has also been added to allow for integrated system logging. A lot of debugging has gone in to finding an issue with some HP equipment. This should now be resolved - there were global variables in the library that were assigned static values which were not being shared by the application that was using the library - thus there was a pseudo-random dependency on system memory being zeroed. With the advent of an integrated DHCP client, the first of the Logic Grenades can finally be created. The reference platform now runs kernel 2.6.22.

It is not intended that libmidnightcode is to be of significant use to developers beyond midnightcode.org, it is only published here as a singular reference for other Midnight Code projects.


Code:
The following code (source, binaries, patches, etc) have been developed or mirrored for this project;

Activity:
This project was initiated on Saturday, the 1st of January 2005. Its last recorded activity stamp is Thursday, the 12th of July 2007.


© 2004-2014 Ian Latter, All rights reserved.
Midnight Code is a registered trademark of Ian Latter
  All Midnight Code source code is distributed under
version 2 of the GNU General Public License (GPL).