source: EcnlProtoTool/trunk/openssl-1.1.0e/crypto/bio/bio_lcl.h@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr
File size: 5.5 KB
Line 
1/*
2 * Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#define USE_SOCKETS
11#include "e_os.h"
12
13/* BEGIN BIO_ADDRINFO/BIO_ADDR stuff. */
14
15#ifndef OPENSSL_NO_SOCK
16/*
17 * Throughout this file and b_addr.c, the existence of the macro
18 * AI_PASSIVE is used to detect the availability of struct addrinfo,
19 * getnameinfo() and getaddrinfo(). If that macro doesn't exist,
20 * we use our own implementation instead.
21 */
22
23/*
24 * It's imperative that these macros get defined before openssl/bio.h gets
25 * included. Otherwise, the AI_PASSIVE hack will not work properly.
26 * For clarity, we check for internal/cryptlib.h since it's a common header
27 * that also includes bio.h.
28 */
29# ifdef HEADER_CRYPTLIB_H
30# error internal/cryptlib.h included before bio_lcl.h
31# endif
32# ifdef HEADER_BIO_H
33# error openssl/bio.h included before bio_lcl.h
34# endif
35
36/*
37 * Undefine AF_UNIX on systems that define it but don't support it.
38 */
39# if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_VMS)
40# undef AF_UNIX
41# endif
42
43# ifdef AI_PASSIVE
44
45/*
46 * There's a bug in VMS C header file netdb.h, where struct addrinfo
47 * always is the P32 variant, but the functions that handle that structure,
48 * such as getaddrinfo() and freeaddrinfo() adapt to the initial pointer
49 * size. The easiest workaround is to force struct addrinfo to be the
50 * 64-bit variant when compiling in P64 mode.
51 */
52# if defined(OPENSSL_SYS_VMS) && __INITIAL_POINTER_SIZE == 64
53# define addrinfo __addrinfo64
54# endif
55
56# define bio_addrinfo_st addrinfo
57# define bai_family ai_family
58# define bai_socktype ai_socktype
59# define bai_protocol ai_protocol
60# define bai_addrlen ai_addrlen
61# define bai_addr ai_addr
62# define bai_next ai_next
63# else
64struct bio_addrinfo_st {
65 int bai_family;
66 int bai_socktype;
67 int bai_protocol;
68 size_t bai_addrlen;
69 struct sockaddr *bai_addr;
70 struct bio_addrinfo_st *bai_next;
71};
72# endif
73
74union bio_addr_st {
75 struct sockaddr sa;
76# ifdef AF_INET6
77 struct sockaddr_in6 s_in6;
78# endif
79 struct sockaddr_in s_in;
80# ifdef AF_UNIX
81 struct sockaddr_un s_un;
82# endif
83};
84#endif
85
86/* END BIO_ADDRINFO/BIO_ADDR stuff. */
87
88#include "internal/cryptlib.h"
89#include <internal/bio.h>
90
91typedef struct bio_f_buffer_ctx_struct {
92 /*-
93 * Buffers are setup like this:
94 *
95 * <---------------------- size ----------------------->
96 * +---------------------------------------------------+
97 * | consumed | remaining | free space |
98 * +---------------------------------------------------+
99 * <-- off --><------- len ------->
100 */
101 /*- BIO *bio; *//*
102 * this is now in the BIO struct
103 */
104 int ibuf_size; /* how big is the input buffer */
105 int obuf_size; /* how big is the output buffer */
106 char *ibuf; /* the char array */
107 int ibuf_len; /* how many bytes are in it */
108 int ibuf_off; /* write/read offset */
109 char *obuf; /* the char array */
110 int obuf_len; /* how many bytes are in it */
111 int obuf_off; /* write/read offset */
112} BIO_F_BUFFER_CTX;
113
114struct bio_st {
115 const BIO_METHOD *method;
116 /* bio, mode, argp, argi, argl, ret */
117 long (*callback) (struct bio_st *, int, const char *, int, long, long);
118 char *cb_arg; /* first argument for the callback */
119 int init;
120 int shutdown;
121 int flags; /* extra storage */
122 int retry_reason;
123 int num;
124 void *ptr;
125 struct bio_st *next_bio; /* used by filter BIOs */
126 struct bio_st *prev_bio; /* used by filter BIOs */
127 int references;
128 uint64_t num_read;
129 uint64_t num_write;
130 CRYPTO_EX_DATA ex_data;
131 CRYPTO_RWLOCK *lock;
132};
133
134#ifndef OPENSSL_NO_SOCK
135# ifdef OPENSSL_SYS_VMS
136typedef unsigned int socklen_t;
137# endif
138
139extern CRYPTO_RWLOCK *bio_lookup_lock;
140
141int BIO_ADDR_make(BIO_ADDR *ap, const struct sockaddr *sa);
142const struct sockaddr *BIO_ADDR_sockaddr(const BIO_ADDR *ap);
143struct sockaddr *BIO_ADDR_sockaddr_noconst(BIO_ADDR *ap);
144socklen_t BIO_ADDR_sockaddr_size(const BIO_ADDR *ap);
145socklen_t BIO_ADDRINFO_sockaddr_size(const BIO_ADDRINFO *bai);
146const struct sockaddr *BIO_ADDRINFO_sockaddr(const BIO_ADDRINFO *bai);
147#endif
148
149extern CRYPTO_RWLOCK *bio_type_lock;
150
151void bio_sock_cleanup_int(void);
152
153#if BIO_FLAGS_UPLINK==0
154/* Shortcut UPLINK calls on most platforms... */
155# define UP_stdin stdin
156# define UP_stdout stdout
157# define UP_stderr stderr
158# define UP_fprintf fprintf
159# define UP_fgets fgets
160# define UP_fread fread
161# define UP_fwrite fwrite
162# undef UP_fsetmod
163# define UP_feof feof
164# define UP_fclose fclose
165
166# define UP_fopen fopen
167# define UP_fseek fseek
168# define UP_ftell ftell
169# define UP_fflush fflush
170# define UP_ferror ferror
171# ifdef _WIN32
172# define UP_fileno _fileno
173# define UP_open _open
174# define UP_read _read
175# define UP_write _write
176# define UP_lseek _lseek
177# define UP_close _close
178# else
179# define UP_fileno fileno
180# define UP_open open
181# define UP_read read
182# define UP_write write
183# define UP_lseek lseek
184# define UP_close close
185# endif
186
187#endif
188
Note: See TracBrowser for help on using the repository browser.