Powerful, light, feature-rich C library

Clone this repo:
  1. 47066e9 Merge "fake code review" by Alex Jones · 9 years ago master
  2. 3bdf276 fake code review by AlexsJones · 9 years ago
  3. 95034e9 fake code review by AlexsJones · 9 years ago
  4. 2479c8f Merge "updated" by Alex Jones · 9 years ago
  5. 75d2fe3 updated by AlexsJones · 9 years ago

jnx Icon jnxlibc

Build Status

Test driven C library for reliable networking, data structures and utility functionality. Constantly in development and refinement to make it as memory/thread safe as possible whilst maintaining no dependencies and low foot print.

####For a solid snapshot of the library check out the releases https://github.com/AlexsJones/jnxlibc/releases

#Key features

  • Lightweight data structures (hash, list, vector, btree, stack, queue)
  • Network socket implmentation supporting multiple transport and IPV4/IPV6
  • Threading & threadsafe data structure API
  • Interprocess communication
  • Verbose terminal logging
  • Easy to use file read/write functions
  • Fast and easy base64 encoding/decoding
  • Auto generated documentation and logical API

#Documentation & Examples

  • MAN docs/man
  • HTML docs/html (Here)
  • Examples of functionality in test suite.
  • Gerrit code review

#Installation

Currently supported platforms: Linux distributions/OS X

Arch linux users

yaourt jnxlibc 

Grab this repo.

./setup/build_and_install

Use -ljnxc when building your project

##Examples

Sending message over network

jnx_socket *udp_sock = jnx_socket_udp_create(AF_INET);
jnx_socket_udp_send(udp_sock,"host","port","message",strlen("message"));
jnx_socket_close(tcp_sock);

Using a binary tree

jnx_btree *tree = jnx_btree_create(sizeof(int),callback_func);
//insertion
int i;
for(i=0;i<10;++i) {
  void *next = (void*)(guids[i]);
  jnx_btree_add(tree,next,next);
}
//get keys
jnx_list *keys = jnx_list_create();
jnx_btree_keys(tree,keys);

while(keys->head) {
  char *a_key = keys->head->data;
  void *val = jnx_btree_lookup(tree,(void*)a_key);
  jnx_btree_remove(tree,a_key,NULL,NULL);
  keys->head = keys->head->next_node;
}
jnx_list_destroy(&keys);
jnx_btree_destroy(&tree);

Manipulating data from a hashmap with thread safety

void *value = jnx_hash_get_ts(hashmap,"Key");
jnx_hash_put_ts(hashmap,"Key",update_value);