summaryrefslogtreecommitdiff
path: root/src/lib/libressl/ressl_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libressl/ressl_server.c')
-rw-r--r--src/lib/libressl/ressl_server.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/lib/libressl/ressl_server.c b/src/lib/libressl/ressl_server.c
new file mode 100644
index 0000000000..243b4bfb09
--- /dev/null
+++ b/src/lib/libressl/ressl_server.c
@@ -0,0 +1,66 @@
1/*
2 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include "ressl_internal.h"
18
19struct ressl *
20ressl_server(void)
21{
22 struct ressl *ctx;
23
24 if ((ctx = ressl_new()) == NULL)
25 return (NULL);
26
27 ctx->flags |= RESSL_SERVER;
28
29 return (ctx);
30}
31
32int
33ressl_listen(struct ressl *ctx, const char *host, const char *port, int af)
34{
35 if ((ctx->flags & RESSL_SERVER) == 0) {
36 ressl_set_error(ctx, "not a server context");
37 goto err;
38 }
39
40err:
41 return (1);
42}
43
44int
45ressl_accept(struct ressl *ctx)
46{
47 if ((ctx->flags & RESSL_SERVER) == 0) {
48 ressl_set_error(ctx, "not a server context");
49 goto err;
50 }
51
52err:
53 return (1);
54}
55
56int
57ressl_accept_socket(struct ressl *ctx, int socket)
58{
59 if ((ctx->flags & RESSL_SERVER) == 0) {
60 ressl_set_error(ctx, "not a server context");
61 goto err;
62 }
63
64err:
65 return (1);
66}