c-multiaddr/include/multiaddr/protocols.h

41 lines
1.1 KiB
C
Raw Normal View History

2016-11-02 16:27:58 +00:00
#ifndef PROTOCOLS
#define PROTOCOLS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "varhexutils.h"
2017-02-15 15:42:06 +00:00
struct Protocol
2016-11-02 16:27:58 +00:00
{
2017-02-15 15:42:06 +00:00
//char hexcode[21];
2016-11-02 16:27:58 +00:00
int deccode;
int size;
char name[30];
};
2017-02-15 15:42:06 +00:00
struct ProtocolListItem {
struct Protocol* current;
struct ProtocolListItem* next;
};
2016-11-02 16:27:58 +00:00
2017-02-15 15:42:06 +00:00
int protocol_REMOVE_id(struct ProtocolListItem* head, int remid); //Function to remove & shift back all data, sort of like c++ vectors.
2017-02-15 15:42:06 +00:00
void unload_protocols(struct ProtocolListItem* head);
2017-02-15 15:42:06 +00:00
/**
* load the available protocols into the global protocol_P
* @returns True(1) on success, otherwise 0
*/
int load_protocols(struct ProtocolListItem** head);
2017-02-15 15:42:06 +00:00
struct Protocol * proto_with_name(const struct ProtocolListItem* head, const char* proto_w_name); //Search for protocol with inputted name
2017-02-15 15:42:06 +00:00
struct Protocol * proto_with_deccode(const struct ProtocolListItem* head, int proto_w_deccode); //Search for protocol with inputted deccode
2017-02-15 15:42:06 +00:00
void protocols_with_string(const struct ProtocolListItem* head, char * meee, int sizi); // NOT FINISHED, DO NOT USE!
2016-11-02 16:27:58 +00:00
#endif