Shadow Network Framework  0.0.1-alpha
C Server Library for Shadow Network Framework
Loading...
Searching...
No Matches
Getting Started

Warning
Make sure to read The warning here about licensing

To include this library use

// Warning, Do not use <SNF/SNF.h>!
#include <SNF.h>
// If you wanna include just a X header eg clt.h
#include <SNF/clt.h>
This file Defines everything related to handling Clients.

Compiling

We have this example code (main.c), we'll go to details after this.

/*
* Example Code
*/
#include <SNF.h>
int main(int argc, char **args)
{
}
void snf_network_init()
Initializes the Network Framwork.
void snf_network_join()
See snf_thpool_join (Works on the Ntwrk Thread Pool)
Note
You code MUST work under C11 or higher for now, (maybe will change in the future )
clang --std=c11 main.c -o <YOUR OUTPUT> -lsnf -lm -luuid -lpthread
Note
In case you installed the Shared library (default installation), then you have the ability to choose a specefic version, where X, Y, Z, are the MAJOR, MINOR, PATCH version numbers respectivly and I is the version extra (eg -alpha or -beta or empty) depending on installed versions, where you could replace -lsnf with either
libsnf.so
libsnf.so.XI
libsnf.so.X.YI
libsnf.so.X.Y.ZI

the -lm -luuid -lpthread linkers are libraires needed for the normal working of SNF

how does SNF work?

The general idea behind SNF is that it sends and receives Requests that have OPCode that define what function to call and automatically handles them behind the scenes on a separate Thread Pool. Currently as of 0.0.1-alpha version there is not much you can customize other than to know that it works to some degree and assign new OPCodes( though useless ), the future version will allow you for more customization. Currently the Shadow Network Framework, receives Requests on it's own and calls the assigned function.

Overview on SNF Requests

Shadow Network Framework is based on an Unnamed Protocol ( Not yet named ) where it sends variables in one buffer

  • Request's Informations
  • Request's OPCode
  • Request's Content (Arguments)

Request's Informations

This part could be

Request's OPCode

It is a series of 4 OPCode Members , 1 of each Rank, Ranks are the following (In order from highest to lowest)

  • Category
  • Sub-Category
  • Command
  • Detail

There is by default Some Base OPcode Members which are required for normal functioning of the framework.

Warning
Never Add/Modify Base OPCode Members!

See the base OPCode Member in opcode.h

This opcode is used to set the server to execute certain functions depending on the values Given there. See SNF_opcode_t::SNF_opcode_struct

See more about OPCode's Structure

Request's Content (Arguments)

The Contents are Strings that are Separated by a character called UNIT_SCEPARATOR

The limitation of treating the arguments as string will be problematic when you want to send binary data, this will of course be changed in future releases , but for now remember *Arguments are ***"strings"****.