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

Warning
  1. Make sure to read The warning here about licensing
  2. Any version Released Under 0.X.Y-alpha is bound to change the core of the SNFramework, and be unstable there is no guarentee of backward nor forward compatibility at all, Every Library under these version are specifically tailored for the matching version of the opposite category (Category as in Client or Server )
    Eg 0.0.1-alpha dotnet Client is made to support and connect to an 0.0.1-alpha C Server, however connecting to 0.0.2-alpha is not guarenteed and may result to undefined behaviour or may throw an SNF Handshake Error or simply hang in the middle of execution.

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 a (main.c) that uses the SNF Library.

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
-l:libsnf.so
-l:libsnf.so.XI
-l:libsnf.so.X.YI
-l: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.2-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.