/* * Secure eXtended Message Passing framework * Secure eXtended Transport layer implementation: (libsxt) * - very similar to SSH2/TLS * - using already proven and tested crypto algos * - better than TLS for message passing * * raw data buffer implementation used within library * * (c) Alexander Vdolainen 2016 * * libsxmp is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * libsxmp is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see ."; * */ #include #include #include #include #include #include #if 0 #define SXTRDB_BURN (1 << 1) typedef struct __sxtrawdatabuffer_type { char *raw; uint32_t rlength; /* raw buffer allocated length */ uint32_t ulength; /* length of used allocated space */ uint32_t curr; /* cursor for read/write operations */ int flags; } sxtrdb_t; #endif /* allocation, freeing */ /* allocate raw buffer with defaults preallocation */ sxtrdb_t *sxtrdb_new(void) { return NULL; } /* will do the same as sxtrdb_new but will allocate given length */ sxtrdb_t *sxtrdb_new_palloc(uint32_t alen) { return NULL; } /* free all allocated space and buffer itself */ void sxtrdb_free(sxtrdb_t *b) { return; } /* read/write */ /* read different types, should return the size of the * ridden data, otherwise error occurs */ uint32_t sxtrdb_read_u8(sxtrdb_t *b, uint8_t *o) { return 0; } uint32_t sxtrdb_read_u16(sxtrdb_t *b, uint16_t *o) { return 0; } uint32_t sxtrdb_read_u32(sxtrdb_t *b, uint32_t *o) { return 0; } uint32_t sxtrdb_read_u64(sxtrdb_t *b, uint64_t *o) { return 0; } /* get raw data, pointer must be allocated with at least required length, * will return size of ridden data */ uint32_t sxtrdb_read_raw(sxtrdb_t *b, void *o, uint32_t rlen) { return 0; } /* write different types, should return the size of the * written data, otherwise error occurs */ uint32_t sxtrdb_write_u8(sxtrdb_t *b, uint8_t u) { return 0; } uint32_t sxtrdb_write_u16(sxtrdb_t *b, uint16_t uu) { return 0; } uint32_t sxtrdb_write_u32(sxtrdb_t *b, uint32_t uu) { return 0; } uint32_t sxtrdb_write_u64(sxtrdb_t *b, uint64_t uu) { return 0; } /* write raw data with the given length */ uint32_t sxtrdb_write_raw(sxtrdb_t *b, void *wi, uint32_t len) { return 0; } /* write raw data *before* existing data */ uint32_t sxtrdb_write_raw_head(sxtrdb_t *b, void *wi, uint32_t len) { return 0; } /* parse */ int sxtrdb_escan_va(sxtrdb_t *b, const char *fmt, int argc, va_list ap) { return 0; } /* print */ uint32_t sxtrdb_print_va(sxtrdb_t *b, const char *fmt, int argc, va_list ap) { return 0; } /* misc */ /* returns length of used space in the buffer */ uint32_t sxtrdb_length(sxtrdb_t *b) { return 0; } /* returns length of allocated space in the buffer */ uint32_t sxtrdb_alength(sxtrdb_t *b) { return 0; } /* returns length of the left data to read */ uint32_t sxtrdb_leftlength(sxtrdb_t *b) { return 0; } /* reaturn a pointer to the raw data */ void *sxtrdb_rdata(sxtrdb_t *b) { return NULL; } /* return pointer to the data currently being read/write */ void *sxtrdb_rdatacur(sxtrdb_t *b) { return NULL; } /* set flags to the raw buffer */ void sxtrdb_setflags(sxtrdb_t *b, int af) { return; } /* exchange flags for raw buff */ void sxtrdb_exflags(sxtrdb_t *b, int nf) { return; } /* let the buffer to use actually used bytes, not all allocated space * will return SXT_SUCCESS on success (or in case if it doesn't required), * SXT_ENOMEM or other error if fails */ int sxtrdb_memopt(sxtrdb_t *b) { return SXT_ERROR; }