diff options
| author | jsing <> | 2014-04-15 17:10:21 +0000 |
|---|---|---|
| committer | jsing <> | 2014-04-15 17:10:21 +0000 |
| commit | 437ab451a41ad8125e8172d969fc5cfdb2dea667 (patch) | |
| tree | a5e51d2435513a7ec4e8364b8b114b9df6e5854b /src | |
| parent | 7a19a50981d49325d35ae058d54f915cbfa1a027 (diff) | |
| download | openbsd-437ab451a41ad8125e8172d969fc5cfdb2dea667.tar.gz openbsd-437ab451a41ad8125e8172d969fc5cfdb2dea667.tar.bz2 openbsd-437ab451a41ad8125e8172d969fc5cfdb2dea667.zip | |
Remove VMS code.
ok miod@ beck@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/bio/bss_rtcp.c | 320 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/bio/bss_rtcp.c | 320 |
2 files changed, 0 insertions, 640 deletions
diff --git a/src/lib/libcrypto/bio/bss_rtcp.c b/src/lib/libcrypto/bio/bss_rtcp.c deleted file mode 100644 index 84d01e58b4..0000000000 --- a/src/lib/libcrypto/bio/bss_rtcp.c +++ /dev/null | |||
| @@ -1,320 +0,0 @@ | |||
| 1 | /* crypto/bio/bss_rtcp.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* Written by David L. Jones <jonesd@kcgl1.eng.ohio-state.edu> | ||
| 60 | * Date: 22-JUL-1996 | ||
| 61 | * Revised: 25-SEP-1997 Update for 0.8.1, BIO_CTRL_SET -> BIO_C_SET_FD | ||
| 62 | */ | ||
| 63 | /* VMS */ | ||
| 64 | #include <stdio.h> | ||
| 65 | #include <stdlib.h> | ||
| 66 | #include <string.h> | ||
| 67 | #include <errno.h> | ||
| 68 | #include "cryptlib.h" | ||
| 69 | #include <openssl/bio.h> | ||
| 70 | |||
| 71 | #include <iodef.h> /* VMS IO$_ definitions */ | ||
| 72 | #include <starlet.h> | ||
| 73 | |||
| 74 | typedef unsigned short io_channel; | ||
| 75 | /*************************************************************************/ | ||
| 76 | struct io_status { short status, count; | ||
| 77 | long flags; | ||
| 78 | }; | ||
| 79 | |||
| 80 | struct rpc_msg { /* Should have member alignment inhibited */ | ||
| 81 | char channel; /* 'A'-app data. 'R'-remote client 'G'-global */ | ||
| 82 | char function; /* 'G'-get, 'P'-put, 'C'-confirm, 'X'-close */ | ||
| 83 | unsigned short int length; /* Amount of data returned or max to return */ | ||
| 84 | char data[4092]; /* variable data */ | ||
| 85 | }; | ||
| 86 | #define RPC_HDR_SIZE (sizeof(struct rpc_msg) - 4092) | ||
| 87 | |||
| 88 | struct rpc_ctx { | ||
| 89 | int filled, pos; | ||
| 90 | struct rpc_msg msg; | ||
| 91 | }; | ||
| 92 | |||
| 93 | static int rtcp_write(BIO *h, const char *buf, int num); | ||
| 94 | static int rtcp_read(BIO *h, char *buf, int size); | ||
| 95 | static int rtcp_puts(BIO *h, const char *str); | ||
| 96 | static int rtcp_gets(BIO *h, char *str, int size); | ||
| 97 | static long rtcp_ctrl(BIO *h, int cmd, long arg1, void *arg2); | ||
| 98 | static int rtcp_new(BIO *h); | ||
| 99 | static int rtcp_free(BIO *data); | ||
| 100 | |||
| 101 | static BIO_METHOD rtcp_method = { | ||
| 102 | BIO_TYPE_FD, | ||
| 103 | "RTCP", | ||
| 104 | rtcp_write, | ||
| 105 | rtcp_read, | ||
| 106 | rtcp_puts, | ||
| 107 | rtcp_gets, | ||
| 108 | rtcp_ctrl, | ||
| 109 | rtcp_new, | ||
| 110 | rtcp_free, | ||
| 111 | NULL, | ||
| 112 | }; | ||
| 113 | |||
| 114 | BIO_METHOD | ||
| 115 | *BIO_s_rtcp(void) | ||
| 116 | { | ||
| 117 | return (&rtcp_method); | ||
| 118 | } | ||
| 119 | /*****************************************************************************/ | ||
| 120 | /* Decnet I/O routines. | ||
| 121 | */ | ||
| 122 | |||
| 123 | #ifdef __DECC | ||
| 124 | #pragma message save | ||
| 125 | #pragma message disable DOLLARID | ||
| 126 | #endif | ||
| 127 | |||
| 128 | static int get(io_channel chan, char *buffer, int maxlen, int *length) | ||
| 129 | { | ||
| 130 | int status; | ||
| 131 | struct io_status iosb; | ||
| 132 | status = sys$qiow(0, chan, IO$_READVBLK, &iosb, 0, 0, buffer, maxlen, | ||
| 133 | 0, 0, 0, 0 ); | ||
| 134 | if ((status & 1) == 1) | ||
| 135 | status = iosb.status; | ||
| 136 | if ((status & 1) == 1 ) | ||
| 137 | *length = iosb.count; | ||
| 138 | return status; | ||
| 139 | } | ||
| 140 | |||
| 141 | static int put(io_channel chan, char *buffer, int length) | ||
| 142 | { | ||
| 143 | int status; | ||
| 144 | struct io_status iosb; | ||
| 145 | status = sys$qiow ( 0, chan, IO$_WRITEVBLK, &iosb, 0, 0, buffer, | ||
| 146 | length, 0, 0, 0, 0 ); | ||
| 147 | if ((status & 1) == 1) | ||
| 148 | status = iosb.status; | ||
| 149 | return status; | ||
| 150 | } | ||
| 151 | |||
| 152 | #ifdef __DECC | ||
| 153 | #pragma message restore | ||
| 154 | #endif | ||
| 155 | |||
| 156 | /***************************************************************************/ | ||
| 157 | |||
| 158 | static int | ||
| 159 | rtcp_new(BIO *bi) | ||
| 160 | { | ||
| 161 | struct rpc_ctx *ctx; | ||
| 162 | bi->init = 1; | ||
| 163 | bi->num = 0; | ||
| 164 | bi->flags = 0; | ||
| 165 | bi->ptr = OPENSSL_malloc(sizeof(struct rpc_ctx)); | ||
| 166 | ctx = (struct rpc_ctx *)bi->ptr; | ||
| 167 | ctx->filled = 0; | ||
| 168 | ctx->pos = 0; | ||
| 169 | return (1); | ||
| 170 | } | ||
| 171 | |||
| 172 | static int | ||
| 173 | rtcp_free(BIO *a) | ||
| 174 | { | ||
| 175 | if (a == NULL) | ||
| 176 | return (0); | ||
| 177 | if (a->ptr) | ||
| 178 | OPENSSL_free(a->ptr); | ||
| 179 | a->ptr = NULL; | ||
| 180 | return (1); | ||
| 181 | } | ||
| 182 | |||
| 183 | static int | ||
| 184 | rtcp_read(BIO *b, char *out, int outl) | ||
| 185 | { | ||
| 186 | int status, length; | ||
| 187 | struct rpc_ctx *ctx; | ||
| 188 | /* | ||
| 189 | * read data, return existing. | ||
| 190 | */ | ||
| 191 | ctx = (struct rpc_ctx *)b->ptr; | ||
| 192 | if (ctx->pos < ctx->filled) { | ||
| 193 | length = ctx->filled - ctx->pos; | ||
| 194 | if (length > outl) | ||
| 195 | length = outl; | ||
| 196 | memmove(out, &ctx->msg.data[ctx->pos], length); | ||
| 197 | ctx->pos += length; | ||
| 198 | return length; | ||
| 199 | } | ||
| 200 | /* | ||
| 201 | * Requst more data from R channel. | ||
| 202 | */ | ||
| 203 | ctx->msg.channel = 'R'; | ||
| 204 | ctx->msg.function = 'G'; | ||
| 205 | ctx->msg.length = sizeof(ctx->msg.data); | ||
| 206 | status = put(b->num, (char *)&ctx->msg, RPC_HDR_SIZE); | ||
| 207 | if ((status & 1) == 0 ) { | ||
| 208 | return -1; | ||
| 209 | } | ||
| 210 | /* | ||
| 211 | * Read. | ||
| 212 | */ | ||
| 213 | ctx->pos = ctx->filled = 0; | ||
| 214 | status = get(b->num, (char *)&ctx->msg, sizeof(ctx->msg), &length); | ||
| 215 | if ((status & 1) == 0) | ||
| 216 | length = -1; | ||
| 217 | if (ctx->msg.channel != 'R' || ctx->msg.function != 'C') { | ||
| 218 | length = -1; | ||
| 219 | } | ||
| 220 | ctx->filled = length - RPC_HDR_SIZE; | ||
| 221 | |||
| 222 | if (ctx->pos < ctx->filled) { | ||
| 223 | length = ctx->filled - ctx->pos; | ||
| 224 | if (length > outl) | ||
| 225 | length = outl; | ||
| 226 | memmove(out, ctx->msg.data, length); | ||
| 227 | ctx->pos += length; | ||
| 228 | return length; | ||
| 229 | } | ||
| 230 | |||
| 231 | return length; | ||
| 232 | } | ||
| 233 | |||
| 234 | static int | ||
| 235 | rtcp_write(BIO *b, const char *in, int inl) | ||
| 236 | { | ||
| 237 | int status, i, segment, length; | ||
| 238 | struct rpc_ctx *ctx; | ||
| 239 | /* | ||
| 240 | * Output data, send in chunks no larger that sizeof(ctx->msg.data). | ||
| 241 | */ | ||
| 242 | ctx = (struct rpc_ctx *)b->ptr; | ||
| 243 | for (i = 0; i < inl; i += segment) { | ||
| 244 | segment = inl - i; | ||
| 245 | if (segment > sizeof(ctx->msg.data)) | ||
| 246 | segment = sizeof(ctx->msg.data); | ||
| 247 | ctx->msg.channel = 'R'; | ||
| 248 | ctx->msg.function = 'P'; | ||
| 249 | ctx->msg.length = segment; | ||
| 250 | memmove(ctx->msg.data, &in[i], segment); | ||
| 251 | status = put(b->num, (char *) &ctx->msg, | ||
| 252 | segment + RPC_HDR_SIZE); | ||
| 253 | if ((status & 1) == 0) { | ||
| 254 | i = -1; | ||
| 255 | break; | ||
| 256 | } | ||
| 257 | |||
| 258 | status = get(b->num, (char *)&ctx->msg, sizeof(ctx->msg), | ||
| 259 | &length ); | ||
| 260 | if (((status&1) == 0) || (length < RPC_HDR_SIZE)) { | ||
| 261 | i = -1; | ||
| 262 | break; | ||
| 263 | } | ||
| 264 | if ((ctx->msg.channel != 'R') || (ctx->msg.function != 'C')) { | ||
| 265 | printf("unexpected response when confirming put %c %c\n", | ||
| 266 | ctx->msg.channel, ctx->msg.function ); | ||
| 267 | |||
| 268 | } | ||
| 269 | } | ||
| 270 | return (i); | ||
| 271 | } | ||
| 272 | |||
| 273 | static long | ||
| 274 | rtcp_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
| 275 | { | ||
| 276 | long ret = 1; | ||
| 277 | |||
| 278 | switch (cmd) { | ||
| 279 | case BIO_CTRL_RESET: | ||
| 280 | case BIO_CTRL_EOF: | ||
| 281 | ret = 1; | ||
| 282 | break; | ||
| 283 | case BIO_C_SET_FD: | ||
| 284 | b->num = num; | ||
| 285 | ret = 1; | ||
| 286 | break; | ||
| 287 | case BIO_CTRL_SET_CLOSE: | ||
| 288 | case BIO_CTRL_FLUSH: | ||
| 289 | case BIO_CTRL_DUP: | ||
| 290 | ret = 1; | ||
| 291 | break; | ||
| 292 | case BIO_CTRL_GET_CLOSE: | ||
| 293 | case BIO_CTRL_INFO: | ||
| 294 | case BIO_CTRL_GET: | ||
| 295 | case BIO_CTRL_PENDING: | ||
| 296 | case BIO_CTRL_WPENDING: | ||
| 297 | default: | ||
| 298 | ret = 0; | ||
| 299 | break; | ||
| 300 | } | ||
| 301 | return (ret); | ||
| 302 | } | ||
| 303 | |||
| 304 | static int | ||
| 305 | rtcp_gets(BIO *bp, char *buf, int size) | ||
| 306 | { | ||
| 307 | return (0); | ||
| 308 | } | ||
| 309 | |||
| 310 | static int | ||
| 311 | rtcp_puts(BIO *bp, const char *str) | ||
| 312 | { | ||
| 313 | int length; | ||
| 314 | if (str == NULL) | ||
| 315 | return (0); | ||
| 316 | length = strlen(str); | ||
| 317 | if (length == 0) | ||
| 318 | return (0); | ||
| 319 | return rtcp_write(bp, str, length); | ||
| 320 | } | ||
diff --git a/src/lib/libssl/src/crypto/bio/bss_rtcp.c b/src/lib/libssl/src/crypto/bio/bss_rtcp.c deleted file mode 100644 index 84d01e58b4..0000000000 --- a/src/lib/libssl/src/crypto/bio/bss_rtcp.c +++ /dev/null | |||
| @@ -1,320 +0,0 @@ | |||
| 1 | /* crypto/bio/bss_rtcp.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* Written by David L. Jones <jonesd@kcgl1.eng.ohio-state.edu> | ||
| 60 | * Date: 22-JUL-1996 | ||
| 61 | * Revised: 25-SEP-1997 Update for 0.8.1, BIO_CTRL_SET -> BIO_C_SET_FD | ||
| 62 | */ | ||
| 63 | /* VMS */ | ||
| 64 | #include <stdio.h> | ||
| 65 | #include <stdlib.h> | ||
| 66 | #include <string.h> | ||
| 67 | #include <errno.h> | ||
| 68 | #include "cryptlib.h" | ||
| 69 | #include <openssl/bio.h> | ||
| 70 | |||
| 71 | #include <iodef.h> /* VMS IO$_ definitions */ | ||
| 72 | #include <starlet.h> | ||
| 73 | |||
| 74 | typedef unsigned short io_channel; | ||
| 75 | /*************************************************************************/ | ||
| 76 | struct io_status { short status, count; | ||
| 77 | long flags; | ||
| 78 | }; | ||
| 79 | |||
| 80 | struct rpc_msg { /* Should have member alignment inhibited */ | ||
| 81 | char channel; /* 'A'-app data. 'R'-remote client 'G'-global */ | ||
| 82 | char function; /* 'G'-get, 'P'-put, 'C'-confirm, 'X'-close */ | ||
| 83 | unsigned short int length; /* Amount of data returned or max to return */ | ||
| 84 | char data[4092]; /* variable data */ | ||
| 85 | }; | ||
| 86 | #define RPC_HDR_SIZE (sizeof(struct rpc_msg) - 4092) | ||
| 87 | |||
| 88 | struct rpc_ctx { | ||
| 89 | int filled, pos; | ||
| 90 | struct rpc_msg msg; | ||
| 91 | }; | ||
| 92 | |||
| 93 | static int rtcp_write(BIO *h, const char *buf, int num); | ||
| 94 | static int rtcp_read(BIO *h, char *buf, int size); | ||
| 95 | static int rtcp_puts(BIO *h, const char *str); | ||
| 96 | static int rtcp_gets(BIO *h, char *str, int size); | ||
| 97 | static long rtcp_ctrl(BIO *h, int cmd, long arg1, void *arg2); | ||
| 98 | static int rtcp_new(BIO *h); | ||
| 99 | static int rtcp_free(BIO *data); | ||
| 100 | |||
| 101 | static BIO_METHOD rtcp_method = { | ||
| 102 | BIO_TYPE_FD, | ||
| 103 | "RTCP", | ||
| 104 | rtcp_write, | ||
| 105 | rtcp_read, | ||
| 106 | rtcp_puts, | ||
| 107 | rtcp_gets, | ||
| 108 | rtcp_ctrl, | ||
| 109 | rtcp_new, | ||
| 110 | rtcp_free, | ||
| 111 | NULL, | ||
| 112 | }; | ||
| 113 | |||
| 114 | BIO_METHOD | ||
| 115 | *BIO_s_rtcp(void) | ||
| 116 | { | ||
| 117 | return (&rtcp_method); | ||
| 118 | } | ||
| 119 | /*****************************************************************************/ | ||
| 120 | /* Decnet I/O routines. | ||
| 121 | */ | ||
| 122 | |||
| 123 | #ifdef __DECC | ||
| 124 | #pragma message save | ||
| 125 | #pragma message disable DOLLARID | ||
| 126 | #endif | ||
| 127 | |||
| 128 | static int get(io_channel chan, char *buffer, int maxlen, int *length) | ||
| 129 | { | ||
| 130 | int status; | ||
| 131 | struct io_status iosb; | ||
| 132 | status = sys$qiow(0, chan, IO$_READVBLK, &iosb, 0, 0, buffer, maxlen, | ||
| 133 | 0, 0, 0, 0 ); | ||
| 134 | if ((status & 1) == 1) | ||
| 135 | status = iosb.status; | ||
| 136 | if ((status & 1) == 1 ) | ||
| 137 | *length = iosb.count; | ||
| 138 | return status; | ||
| 139 | } | ||
| 140 | |||
| 141 | static int put(io_channel chan, char *buffer, int length) | ||
| 142 | { | ||
| 143 | int status; | ||
| 144 | struct io_status iosb; | ||
| 145 | status = sys$qiow ( 0, chan, IO$_WRITEVBLK, &iosb, 0, 0, buffer, | ||
| 146 | length, 0, 0, 0, 0 ); | ||
| 147 | if ((status & 1) == 1) | ||
| 148 | status = iosb.status; | ||
| 149 | return status; | ||
| 150 | } | ||
| 151 | |||
| 152 | #ifdef __DECC | ||
| 153 | #pragma message restore | ||
| 154 | #endif | ||
| 155 | |||
| 156 | /***************************************************************************/ | ||
| 157 | |||
| 158 | static int | ||
| 159 | rtcp_new(BIO *bi) | ||
| 160 | { | ||
| 161 | struct rpc_ctx *ctx; | ||
| 162 | bi->init = 1; | ||
| 163 | bi->num = 0; | ||
| 164 | bi->flags = 0; | ||
| 165 | bi->ptr = OPENSSL_malloc(sizeof(struct rpc_ctx)); | ||
| 166 | ctx = (struct rpc_ctx *)bi->ptr; | ||
| 167 | ctx->filled = 0; | ||
| 168 | ctx->pos = 0; | ||
| 169 | return (1); | ||
| 170 | } | ||
| 171 | |||
| 172 | static int | ||
| 173 | rtcp_free(BIO *a) | ||
| 174 | { | ||
| 175 | if (a == NULL) | ||
| 176 | return (0); | ||
| 177 | if (a->ptr) | ||
| 178 | OPENSSL_free(a->ptr); | ||
| 179 | a->ptr = NULL; | ||
| 180 | return (1); | ||
| 181 | } | ||
| 182 | |||
| 183 | static int | ||
| 184 | rtcp_read(BIO *b, char *out, int outl) | ||
| 185 | { | ||
| 186 | int status, length; | ||
| 187 | struct rpc_ctx *ctx; | ||
| 188 | /* | ||
| 189 | * read data, return existing. | ||
| 190 | */ | ||
| 191 | ctx = (struct rpc_ctx *)b->ptr; | ||
| 192 | if (ctx->pos < ctx->filled) { | ||
| 193 | length = ctx->filled - ctx->pos; | ||
| 194 | if (length > outl) | ||
| 195 | length = outl; | ||
| 196 | memmove(out, &ctx->msg.data[ctx->pos], length); | ||
| 197 | ctx->pos += length; | ||
| 198 | return length; | ||
| 199 | } | ||
| 200 | /* | ||
| 201 | * Requst more data from R channel. | ||
| 202 | */ | ||
| 203 | ctx->msg.channel = 'R'; | ||
| 204 | ctx->msg.function = 'G'; | ||
| 205 | ctx->msg.length = sizeof(ctx->msg.data); | ||
| 206 | status = put(b->num, (char *)&ctx->msg, RPC_HDR_SIZE); | ||
| 207 | if ((status & 1) == 0 ) { | ||
| 208 | return -1; | ||
| 209 | } | ||
| 210 | /* | ||
| 211 | * Read. | ||
| 212 | */ | ||
| 213 | ctx->pos = ctx->filled = 0; | ||
| 214 | status = get(b->num, (char *)&ctx->msg, sizeof(ctx->msg), &length); | ||
| 215 | if ((status & 1) == 0) | ||
| 216 | length = -1; | ||
| 217 | if (ctx->msg.channel != 'R' || ctx->msg.function != 'C') { | ||
| 218 | length = -1; | ||
| 219 | } | ||
| 220 | ctx->filled = length - RPC_HDR_SIZE; | ||
| 221 | |||
| 222 | if (ctx->pos < ctx->filled) { | ||
| 223 | length = ctx->filled - ctx->pos; | ||
| 224 | if (length > outl) | ||
| 225 | length = outl; | ||
| 226 | memmove(out, ctx->msg.data, length); | ||
| 227 | ctx->pos += length; | ||
| 228 | return length; | ||
| 229 | } | ||
| 230 | |||
| 231 | return length; | ||
| 232 | } | ||
| 233 | |||
| 234 | static int | ||
| 235 | rtcp_write(BIO *b, const char *in, int inl) | ||
| 236 | { | ||
| 237 | int status, i, segment, length; | ||
| 238 | struct rpc_ctx *ctx; | ||
| 239 | /* | ||
| 240 | * Output data, send in chunks no larger that sizeof(ctx->msg.data). | ||
| 241 | */ | ||
| 242 | ctx = (struct rpc_ctx *)b->ptr; | ||
| 243 | for (i = 0; i < inl; i += segment) { | ||
| 244 | segment = inl - i; | ||
| 245 | if (segment > sizeof(ctx->msg.data)) | ||
| 246 | segment = sizeof(ctx->msg.data); | ||
| 247 | ctx->msg.channel = 'R'; | ||
| 248 | ctx->msg.function = 'P'; | ||
| 249 | ctx->msg.length = segment; | ||
| 250 | memmove(ctx->msg.data, &in[i], segment); | ||
| 251 | status = put(b->num, (char *) &ctx->msg, | ||
| 252 | segment + RPC_HDR_SIZE); | ||
| 253 | if ((status & 1) == 0) { | ||
| 254 | i = -1; | ||
| 255 | break; | ||
| 256 | } | ||
| 257 | |||
| 258 | status = get(b->num, (char *)&ctx->msg, sizeof(ctx->msg), | ||
| 259 | &length ); | ||
| 260 | if (((status&1) == 0) || (length < RPC_HDR_SIZE)) { | ||
| 261 | i = -1; | ||
| 262 | break; | ||
| 263 | } | ||
| 264 | if ((ctx->msg.channel != 'R') || (ctx->msg.function != 'C')) { | ||
| 265 | printf("unexpected response when confirming put %c %c\n", | ||
| 266 | ctx->msg.channel, ctx->msg.function ); | ||
| 267 | |||
| 268 | } | ||
| 269 | } | ||
| 270 | return (i); | ||
| 271 | } | ||
| 272 | |||
| 273 | static long | ||
| 274 | rtcp_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
| 275 | { | ||
| 276 | long ret = 1; | ||
| 277 | |||
| 278 | switch (cmd) { | ||
| 279 | case BIO_CTRL_RESET: | ||
| 280 | case BIO_CTRL_EOF: | ||
| 281 | ret = 1; | ||
| 282 | break; | ||
| 283 | case BIO_C_SET_FD: | ||
| 284 | b->num = num; | ||
| 285 | ret = 1; | ||
| 286 | break; | ||
| 287 | case BIO_CTRL_SET_CLOSE: | ||
| 288 | case BIO_CTRL_FLUSH: | ||
| 289 | case BIO_CTRL_DUP: | ||
| 290 | ret = 1; | ||
| 291 | break; | ||
| 292 | case BIO_CTRL_GET_CLOSE: | ||
| 293 | case BIO_CTRL_INFO: | ||
| 294 | case BIO_CTRL_GET: | ||
| 295 | case BIO_CTRL_PENDING: | ||
| 296 | case BIO_CTRL_WPENDING: | ||
| 297 | default: | ||
| 298 | ret = 0; | ||
| 299 | break; | ||
| 300 | } | ||
| 301 | return (ret); | ||
| 302 | } | ||
| 303 | |||
| 304 | static int | ||
| 305 | rtcp_gets(BIO *bp, char *buf, int size) | ||
| 306 | { | ||
| 307 | return (0); | ||
| 308 | } | ||
| 309 | |||
| 310 | static int | ||
| 311 | rtcp_puts(BIO *bp, const char *str) | ||
| 312 | { | ||
| 313 | int length; | ||
| 314 | if (str == NULL) | ||
| 315 | return (0); | ||
| 316 | length = strlen(str); | ||
| 317 | if (length == 0) | ||
| 318 | return (0); | ||
| 319 | return rtcp_write(bp, str, length); | ||
| 320 | } | ||
