Blame doc/examples/tlsproxy/buffer.h

Packit aea12f
/*
Packit aea12f
The MIT License (MIT)
Packit aea12f
Packit aea12f
Copyright (c) 2016 Wrymouth Innovation Ltd
Packit aea12f
Packit aea12f
Permission is hereby granted, free of charge, to any person obtaining a
Packit aea12f
copy of this software and associated documentation files (the "Software"),
Packit aea12f
to deal in the Software without restriction, including without limitation
Packit aea12f
the rights to use, copy, modify, merge, publish, distribute, sublicense,
Packit aea12f
and/or sell copies of the Software, and to permit persons to whom the
Packit aea12f
Software is furnished to do so, subject to the following conditions:
Packit aea12f
Packit aea12f
The above copyright notice and this permission notice shall be included
Packit aea12f
in all copies or substantial portions of the Software.
Packit aea12f
Packit aea12f
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Packit aea12f
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Packit aea12f
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
Packit aea12f
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
Packit aea12f
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Packit aea12f
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Packit aea12f
OTHER DEALINGS IN THE SOFTWARE.
Packit aea12f
*/
Packit aea12f
Packit aea12f
#ifndef __TLSPROXY_BUFFERS_H
Packit aea12f
#define __TLSPROXY_BUFFERS_H
Packit aea12f
Packit aea12f
#include <stdlib.h>
Packit aea12f
#include <sys/types.h>
Packit aea12f
Packit aea12f
typedef struct buffer buffer_t;
Packit aea12f
Packit aea12f
buffer_t *bufNew (ssize_t size, ssize_t hwm);
Packit aea12f
void bufFree (buffer_t * b);
Packit aea12f
ssize_t bufGetReadSpan (buffer_t * b, void **addr);
Packit aea12f
ssize_t bufGetWriteSpan (buffer_t * b, void **addr);
Packit aea12f
void bufDoneRead (buffer_t * b, ssize_t size);
Packit aea12f
void bufDoneWrite (buffer_t * b, ssize_t size);
Packit aea12f
int bufIsEmpty (buffer_t * b);
Packit aea12f
int bufIsFull (buffer_t * b);
Packit aea12f
int bufIsOverHWM (buffer_t * b);
Packit aea12f
ssize_t bufGetFree (buffer_t * b);
Packit aea12f
ssize_t bufGetCount (buffer_t * b);
Packit aea12f
Packit aea12f
#endif