stream.c
621 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdarg.h>
#include <openssl/ssl.h>
#include "class.h"
#include "interface/class.h"
#include "stream.h"
static
int
streamCtor(void * _this, va_list * params)
{
Stream this = _this;
this->type = va_arg(* params, StreamHandleType);
switch(this->type) {
case STREAM_FD:
(this->handle).fd = va_arg(* params, int);
break;
case STREAM_SSL:
(this->handle).ssl = va_arg(* params, SSL*);
break;
default:
return -1;
}
return 0;
}
static
void
streamDtor(void * _this)
{
}
INIT_IFACE(Class, streamCtor, streamDtor, NULL);
CREATE_CLASS(Stream, NULL, IFACE(Class));
// vim: set ts=4 sw=4: