initial commit
This commit is contained in:
parent
72dd752533
commit
af1af490ef
3 changed files with 48 additions and 0 deletions
|
@ -1,2 +1,6 @@
|
|||
# c-multicodec
|
||||
multicodec for IPFS in C.
|
||||
|
||||
An implementation of multicodec in C. For the spec, check out https://github.com/multiformats/multicodec
|
||||
|
||||
For an implmentation in go, see https://github.com/multiformats/go-multicodec
|
||||
|
|
9
multicodec.c
Normal file
9
multicodec.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "multicodec.h"
|
||||
|
||||
int multicodec_encode(const char* codecName, char* inData, size_t inDataLength, char* outData, size_t maxOutDataLength) {
|
||||
|
||||
}
|
||||
|
||||
int multicodec_decode(char* inData, size_t inDataLength, char* outData, size_t maxOutDataLength) {
|
||||
|
||||
}
|
35
multicodec.h
Normal file
35
multicodec.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* An implementation of multicodec
|
||||
* See https://github.com/multiformats/multicodec
|
||||
*/
|
||||
|
||||
#ifndef __MULTICODEC_H__
|
||||
#define __MULTICODEC_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MULTICODEC_RAW_BINARY 0x052f6269632f
|
||||
#define MULTICODEC_ASCII_BASE_2 0x042f62322f
|
||||
|
||||
/**
|
||||
* Encode a char array using the specified encoding
|
||||
* @param codecName a standard name of the codec
|
||||
* @param inData the incoming data to be encoded
|
||||
* @param inDataLength the length of the inData
|
||||
* @param outData a place to store the outgoing data that is at least maxOutDataLength in size
|
||||
* @param maxOutDataLength the max size for the output
|
||||
* @returns an error code or 0 if all is well
|
||||
*/
|
||||
int multicodec_encode(const char* codecName, char* inData, size_t inDataLength, char* outData, size_t maxOutDataLength);
|
||||
|
||||
/**
|
||||
* Decode a multicodec encoded data array
|
||||
* @param inData the data to be decoded
|
||||
* @param inDataLength the length of the data to be encoded
|
||||
* @param outData the array to put the results in
|
||||
* @param maxOutDataLength the maximum size of the data
|
||||
* @returns an error code or 0 if all is well
|
||||
*/
|
||||
int multicodec_decode(char* inData, size_t inDataLength, char* outData, size_t maxOutDataLength);
|
||||
|
||||
#endif // __MULTICODEC_H__
|
Loading…
Reference in a new issue