summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/bss_rtcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bio/bss_rtcp.c')
-rw-r--r--src/lib/libcrypto/bio/bss_rtcp.c67
1 files changed, 32 insertions, 35 deletions
diff --git a/src/lib/libcrypto/bio/bss_rtcp.c b/src/lib/libcrypto/bio/bss_rtcp.c
index 6eb434dee8..7dae485564 100644
--- a/src/lib/libcrypto/bio/bss_rtcp.c
+++ b/src/lib/libcrypto/bio/bss_rtcp.c
@@ -58,6 +58,7 @@
58 58
59/* Written by David L. Jones <jonesd@kcgl1.eng.ohio-state.edu> 59/* Written by David L. Jones <jonesd@kcgl1.eng.ohio-state.edu>
60 * Date: 22-JUL-1996 60 * Date: 22-JUL-1996
61 * Revised: 25-SEP-1997 Update for 0.8.1, BIO_CTRL_SET -> BIO_C_SET_FD
61 */ 62 */
62/* VMS */ 63/* VMS */
63#include <stdio.h> 64#include <stdio.h>
@@ -65,10 +66,11 @@
65#include <string.h> 66#include <string.h>
66#include <errno.h> 67#include <errno.h>
67#include "cryptlib.h" 68#include "cryptlib.h"
68#include "bio.h" 69#include <openssl/bio.h>
69 70
70#include <iodef.h> /* VMS IO$_ definitions */ 71#include <iodef.h> /* VMS IO$_ definitions */
71extern int SYS$QIOW(); 72#include <starlet.h>
73
72typedef unsigned short io_channel; 74typedef unsigned short io_channel;
73/*************************************************************************/ 75/*************************************************************************/
74struct io_status { short status, count; long flags; }; 76struct io_status { short status, count; long flags; };
@@ -86,11 +88,11 @@ struct rpc_ctx {
86 struct rpc_msg msg; 88 struct rpc_msg msg;
87}; 89};
88 90
89static int rtcp_write(BIO *h,char *buf,int num); 91static int rtcp_write(BIO *h,const char *buf,int num);
90static int rtcp_read(BIO *h,char *buf,int size); 92static int rtcp_read(BIO *h,char *buf,int size);
91static int rtcp_puts(BIO *h,char *str); 93static int rtcp_puts(BIO *h,const char *str);
92static int rtcp_gets(BIO *h,char *str,int size); 94static int rtcp_gets(BIO *h,char *str,int size);
93static long rtcp_ctrl(BIO *h,int cmd,long arg1,char *arg2); 95static long rtcp_ctrl(BIO *h,int cmd,long arg1,void *arg2);
94static int rtcp_new(BIO *h); 96static int rtcp_new(BIO *h);
95static int rtcp_free(BIO *data); 97static int rtcp_free(BIO *data);
96 98
@@ -105,20 +107,27 @@ static BIO_METHOD rtcp_method=
105 rtcp_ctrl, 107 rtcp_ctrl,
106 rtcp_new, 108 rtcp_new,
107 rtcp_free, 109 rtcp_free,
110 NULL,
108 }; 111 };
109 112
110BIO_METHOD *BIO_s_rtcp() 113BIO_METHOD *BIO_s_rtcp(void)
111 { 114 {
112 return(&rtcp_method); 115 return(&rtcp_method);
113 } 116 }
114/*****************************************************************************/ 117/*****************************************************************************/
115/* Decnet I/O routines. 118/* Decnet I/O routines.
116 */ 119 */
120
121#ifdef __DECC
122#pragma message save
123#pragma message disable DOLLARID
124#endif
125
117static int get ( io_channel chan, char *buffer, int maxlen, int *length ) 126static int get ( io_channel chan, char *buffer, int maxlen, int *length )
118{ 127{
119 int status; 128 int status;
120 struct io_status iosb; 129 struct io_status iosb;
121 status = SYS$QIOW ( 0, chan, IO$_READVBLK, &iosb, 0, 0, 130 status = sys$qiow ( 0, chan, IO$_READVBLK, &iosb, 0, 0,
122 buffer, maxlen, 0, 0, 0, 0 ); 131 buffer, maxlen, 0, 0, 0, 0 );
123 if ( (status&1) == 1 ) status = iosb.status; 132 if ( (status&1) == 1 ) status = iosb.status;
124 if ( (status&1) == 1 ) *length = iosb.count; 133 if ( (status&1) == 1 ) *length = iosb.count;
@@ -129,40 +138,40 @@ static int put ( io_channel chan, char *buffer, int length )
129{ 138{
130 int status; 139 int status;
131 struct io_status iosb; 140 struct io_status iosb;
132 status = SYS$QIOW ( 0, chan, IO$_WRITEVBLK, &iosb, 0, 0, 141 status = sys$qiow ( 0, chan, IO$_WRITEVBLK, &iosb, 0, 0,
133 buffer, length, 0, 0, 0, 0 ); 142 buffer, length, 0, 0, 0, 0 );
134 if ( (status&1) == 1 ) status = iosb.status; 143 if ( (status&1) == 1 ) status = iosb.status;
135 return status; 144 return status;
136} 145}
146
147#ifdef __DECC
148#pragma message restore
149#endif
150
137/***************************************************************************/ 151/***************************************************************************/
138 152
139static int rtcp_new(bi) 153static int rtcp_new(BIO *bi)
140BIO *bi;
141{ 154{
142 struct rpc_ctx *ctx; 155 struct rpc_ctx *ctx;
143 bi->init=1; 156 bi->init=1;
144 bi->num=0; 157 bi->num=0;
145 bi->flags = 0; 158 bi->flags = 0;
146 bi->ptr=Malloc(sizeof(struct rpc_ctx)); 159 bi->ptr=OPENSSL_malloc(sizeof(struct rpc_ctx));
147 ctx = (struct rpc_ctx *) bi->ptr; 160 ctx = (struct rpc_ctx *) bi->ptr;
148 ctx->filled = 0; 161 ctx->filled = 0;
149 ctx->pos = 0; 162 ctx->pos = 0;
150 return(1); 163 return(1);
151} 164}
152 165
153static int rtcp_free(a) 166static int rtcp_free(BIO *a)
154BIO *a;
155{ 167{
156 if (a == NULL) return(0); 168 if (a == NULL) return(0);
157 if ( a->ptr ) Free ( a->ptr ); 169 if ( a->ptr ) OPENSSL_free ( a->ptr );
158 a->ptr = NULL; 170 a->ptr = NULL;
159 return(1); 171 return(1);
160} 172}
161 173
162static int rtcp_read(b,out,outl) 174static int rtcp_read(BIO *b, char *out, int outl)
163BIO *b;
164char *out;
165int outl;
166{ 175{
167 int status, length; 176 int status, length;
168 struct rpc_ctx *ctx; 177 struct rpc_ctx *ctx;
@@ -209,10 +218,7 @@ int outl;
209 return length; 218 return length;
210} 219}
211 220
212static int rtcp_write(b,in,inl) 221static int rtcp_write(BIO *b, const char *in, int inl)
213BIO *b;
214char *in;
215int inl;
216{ 222{
217 int status, i, segment, length; 223 int status, i, segment, length;
218 struct rpc_ctx *ctx; 224 struct rpc_ctx *ctx;
@@ -241,11 +247,7 @@ int inl;
241 return(i); 247 return(i);
242} 248}
243 249
244static long rtcp_ctrl(b,cmd,num,ptr) 250static long rtcp_ctrl(BIO *b, int cmd, long num, void *ptr)
245BIO *b;
246int cmd;
247long num;
248char *ptr;
249 { 251 {
250 long ret=1; 252 long ret=1;
251 253
@@ -255,7 +257,7 @@ char *ptr;
255 case BIO_CTRL_EOF: 257 case BIO_CTRL_EOF:
256 ret = 1; 258 ret = 1;
257 break; 259 break;
258 case BIO_CTRL_SET: 260 case BIO_C_SET_FD:
259 b->num = num; 261 b->num = num;
260 ret = 1; 262 ret = 1;
261 break; 263 break;
@@ -276,17 +278,12 @@ char *ptr;
276 return(ret); 278 return(ret);
277 } 279 }
278 280
279static int rtcp_gets(bp,buf,size) 281static int rtcp_gets(BIO *bp, char *buf, int size)
280BIO *bp;
281char *buf;
282int size;
283 { 282 {
284 return(0); 283 return(0);
285 } 284 }
286 285
287static int rtcp_puts(bp,str) 286static int rtcp_puts(BIO *bp, const char *str)
288BIO *bp;
289char *str;
290{ 287{
291 int length; 288 int length;
292 if (str == NULL) return(0); 289 if (str == NULL) return(0);