summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorjsing <>2016-11-04 10:50:32 +0000
committerjsing <>2016-11-04 10:50:32 +0000
commitd8daea57d18a9874231c2f5b625ba176d59586b2 (patch)
treec8adb83828e7bb385b7459bffed33a64f84aabaa /src/lib
parentcb9e8ed1a8668be65950c7b8199c3d769af795be (diff)
downloadopenbsd-d8daea57d18a9874231c2f5b625ba176d59586b2.tar.gz
openbsd-d8daea57d18a9874231c2f5b625ba176d59586b2.tar.bz2
openbsd-d8daea57d18a9874231c2f5b625ba176d59586b2.zip
Rename the internal bio related functions so that they have a common
prefix. Makes the code more readable and removes shadowing.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libtls/tls_bio_cb.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/lib/libtls/tls_bio_cb.c b/src/lib/libtls/tls_bio_cb.c
index 28d93a8208..b36018761d 100644
--- a/src/lib/libtls/tls_bio_cb.c
+++ b/src/lib/libtls/tls_bio_cb.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_bio_cb.c,v 1.6 2016/11/04 08:17:43 jsing Exp $ */ 1/* $OpenBSD: tls_bio_cb.c,v 1.7 2016/11/04 10:50:32 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2016 Tobias Pape <tobias@netshed.de> 3 * Copyright (c) 2016 Tobias Pape <tobias@netshed.de>
4 * 4 *
@@ -24,12 +24,12 @@
24#include <tls.h> 24#include <tls.h>
25#include "tls_internal.h" 25#include "tls_internal.h"
26 26
27static int write_cb(BIO *b, const char *buf, int num); 27static int bio_cb_write(BIO *b, const char *buf, int num);
28static int read_cb(BIO *b, char *buf, int size); 28static int bio_cb_read(BIO *b, char *buf, int size);
29static int puts_cb(BIO *b, const char *str); 29static int bio_cb_puts(BIO *b, const char *str);
30static long ctrl_cb(BIO *b, int cmd, long num, void *ptr); 30static long bio_cb_ctrl(BIO *b, int cmd, long num, void *ptr);
31static int new_cb(BIO *b); 31static int bio_cb_new(BIO *b);
32static int free_cb(BIO *data); 32static int bio_cb_free(BIO *data);
33 33
34struct bio_cb_st { 34struct bio_cb_st {
35 int (*write_cb)(BIO *h, const char *buf, int num, void *cb_arg); 35 int (*write_cb)(BIO *h, const char *buf, int num, void *cb_arg);
@@ -37,21 +37,21 @@ struct bio_cb_st {
37 void *cb_arg; 37 void *cb_arg;
38}; 38};
39 39
40static BIO_METHOD cb_method = { 40static BIO_METHOD bio_cb_method = {
41 .type = BIO_TYPE_MEM, 41 .type = BIO_TYPE_MEM,
42 .name = "libtls_callbacks", 42 .name = "libtls_callbacks",
43 .bwrite = write_cb, 43 .bwrite = bio_cb_write,
44 .bread = read_cb, 44 .bread = bio_cb_read,
45 .bputs = puts_cb, 45 .bputs = bio_cb_puts,
46 .ctrl = ctrl_cb, 46 .ctrl = bio_cb_ctrl,
47 .create = new_cb, 47 .create = bio_cb_new,
48 .destroy = free_cb 48 .destroy = bio_cb_free,
49}; 49};
50 50
51static BIO_METHOD * 51static BIO_METHOD *
52bio_s_cb(void) 52bio_s_cb(void)
53{ 53{
54 return (&cb_method); 54 return (&bio_cb_method);
55} 55}
56 56
57static int 57static int
@@ -84,7 +84,7 @@ bio_set_cb_arg(BIO *bi, void *cb_arg)
84} 84}
85 85
86static int 86static int
87new_cb(BIO *bi) 87bio_cb_new(BIO *bi)
88{ 88{
89 struct bio_cb_st *bcb; 89 struct bio_cb_st *bcb;
90 90
@@ -101,7 +101,7 @@ new_cb(BIO *bi)
101} 101}
102 102
103static int 103static int
104free_cb(BIO *bi) 104bio_cb_free(BIO *bi)
105{ 105{
106 if (bi == NULL) 106 if (bi == NULL)
107 return (0); 107 return (0);
@@ -117,30 +117,30 @@ free_cb(BIO *bi)
117} 117}
118 118
119static int 119static int
120read_cb(BIO *b, char *buf, int size) 120bio_cb_read(BIO *b, char *buf, int size)
121{ 121{
122 struct bio_cb_st *bcb = b->ptr; 122 struct bio_cb_st *bcb = b->ptr;
123 return (bcb->read_cb(b, buf, size, bcb->cb_arg)); 123 return (bcb->read_cb(b, buf, size, bcb->cb_arg));
124} 124}
125 125
126static int 126static int
127write_cb(BIO *b, const char *buf, int num) 127bio_cb_write(BIO *b, const char *buf, int num)
128{ 128{
129 struct bio_cb_st *bcb = b->ptr; 129 struct bio_cb_st *bcb = b->ptr;
130 return (bcb->write_cb(b, buf, num, bcb->cb_arg)); 130 return (bcb->write_cb(b, buf, num, bcb->cb_arg));
131} 131}
132 132
133static int 133static int
134puts_cb(BIO *b, const char *str) 134bio_cb_puts(BIO *b, const char *str)
135{ 135{
136 int n; 136 int n;
137 137
138 n = strlen(str); 138 n = strlen(str);
139 return (write_cb(b, str, n)); 139 return (bio_cb_write(b, str, n));
140} 140}
141 141
142static long 142static long
143ctrl_cb(BIO *b, int cmd, long num, void *ptr) 143bio_cb_ctrl(BIO *b, int cmd, long num, void *ptr)
144{ 144{
145 long ret = 1; 145 long ret = 1;
146 146