• About TV's server
  • New in version 3.20
  • New in version 3.10
  • About the source code
  • About protocols/plugins
  • TV's server API
  • Protocol Initialisation
  • Protocol binding
  • Protocol Listening and handling
  • Protocol data storage
  • Control panel
  • Multi column list
  • Time and date
  • Http protocol functions
  • Unimplemented and/or replaced functions
  • ProtocolSignature structure

    Contains information about the first few bytes of a protocol send by a client


    typedef struct ProtocolSignature{
    int len;
    char buf[len];
    } ProtocolSignature;




    This is an example of how to make a list of ProtocolSignature structures based on the HTTP protocol that supports the commands GET, POST and HEAD.
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include "tvsserver_base.h"
    #include "tvs_redefine_api_names.h"
    char* supportedCommands[AMMOUNT_OF_SUPPPORTED_COMMANDS] = {"GET", "POST", "HEAD"};
    int main() {
    	createProtocolSignatureFromArray(supportedCommands, AMMOUNT_OF_SUPPPORTED_COMMANDS);
    char* createProtocolSignatureFromArray(char* p_array[], int ammountItems) {
    	int bufSize, i, tmpLen;
    	char* tmpBuf, *retBuf;
    	//Calculate the size of every integer that will contain the size of the command (that last one is zero)
    	bufSize = (ammountItems + 1) * sizeof(int);
    	//Calculate the size of the buf members for the ProtocolSignature structure
    	for(i=0; i<ammountItems; i++) {
    		bufSize += strlen(p_array[i]);
    	//Allocate size for the ProtocolSignature structure
    	retBuf = (char*) malloc(bufSize);
    	tmpBuf = retBuf;
    	//Copy every item with there size to the array
    	for(i=0; i<ammountItems; i++) {
    		tmpLen = strlen(p_array[i]);
    		*(int*)tmpBuf = tmpLen;
    		tmpBuf += sizeof(int);
    		strcpy(tmpBuf, p_array[i]);
    		tmpBuf += tmpLen;
    	*(int*)tmpBuf = 0;
    	return retBuf;


    Minimum supported API 1.00
    Header tvsserver_base.h