Update files for OpenSSL-1.0.0f import.
[dragonfly.git] / secure / lib / libcrypto / man / BIO_ctrl.3
CommitLineData
e3261593 1.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.19)
8b0cefbb
JR
2.\"
3.\" Standard preamble:
4.\" ========================================================================
8b0cefbb 5.de Sp \" Vertical space (when we can't use .PP)
984263bc
MD
6.if t .sp .5v
7.if n .sp
8..
8b0cefbb 9.de Vb \" Begin verbatim text
984263bc
MD
10.ft CW
11.nf
12.ne \\$1
13..
8b0cefbb 14.de Ve \" End verbatim text
984263bc 15.ft R
984263bc
MD
16.fi
17..
8b0cefbb
JR
18.\" Set up some character translations and predefined strings. \*(-- will
19.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
e257b235
PA
20.\" double quote, and \*(R" will give a right double quote. \*(C+ will
21.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
22.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
23.\" nothing in troff, for use with C<>.
24.tr \(*W-
8b0cefbb 25.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
984263bc 26.ie n \{\
8b0cefbb
JR
27. ds -- \(*W-
28. ds PI pi
29. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
31. ds L" ""
32. ds R" ""
33. ds C` ""
34. ds C' ""
984263bc
MD
35'br\}
36.el\{\
8b0cefbb
JR
37. ds -- \|\(em\|
38. ds PI \(*p
39. ds L" ``
40. ds R" ''
984263bc 41'br\}
8b0cefbb 42.\"
e257b235
PA
43.\" Escape single quotes in literal strings from groff's Unicode transform.
44.ie \n(.g .ds Aq \(aq
45.el .ds Aq '
46.\"
8b0cefbb 47.\" If the F register is turned on, we'll generate index entries on stderr for
01185282 48.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
8b0cefbb
JR
49.\" entries marked with X<> in POD. Of course, you'll have to process the
50.\" output yourself in some meaningful fashion.
e257b235 51.ie \nF \{\
8b0cefbb
JR
52. de IX
53. tm Index:\\$1\t\\n%\t"\\$2"
984263bc 54..
8b0cefbb
JR
55. nr % 0
56. rr F
984263bc 57.\}
e257b235
PA
58.el \{\
59. de IX
60..
61.\}
aac4ff6f 62.\"
8b0cefbb
JR
63.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64.\" Fear. Run. Save yourself. No user-serviceable parts.
65. \" fudge factors for nroff and troff
984263bc 66.if n \{\
8b0cefbb
JR
67. ds #H 0
68. ds #V .8m
69. ds #F .3m
70. ds #[ \f1
71. ds #] \fP
984263bc
MD
72.\}
73.if t \{\
8b0cefbb
JR
74. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75. ds #V .6m
76. ds #F 0
77. ds #[ \&
78. ds #] \&
984263bc 79.\}
8b0cefbb 80. \" simple accents for nroff and troff
984263bc 81.if n \{\
8b0cefbb
JR
82. ds ' \&
83. ds ` \&
84. ds ^ \&
85. ds , \&
86. ds ~ ~
87. ds /
984263bc
MD
88.\}
89.if t \{\
8b0cefbb
JR
90. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
984263bc 96.\}
8b0cefbb 97. \" troff and (daisy-wheel) nroff accents
984263bc
MD
98.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105.ds ae a\h'-(\w'a'u*4/10)'e
106.ds Ae A\h'-(\w'A'u*4/10)'E
8b0cefbb 107. \" corrections for vroff
984263bc
MD
108.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
8b0cefbb 110. \" for low resolution devices (crt and lpr)
984263bc
MD
111.if \n(.H>23 .if \n(.V>19 \
112\{\
8b0cefbb
JR
113. ds : e
114. ds 8 ss
115. ds o a
116. ds d- d\h'-1'\(ga
117. ds D- D\h'-1'\(hy
118. ds th \o'bp'
119. ds Th \o'LP'
120. ds ae ae
121. ds Ae AE
984263bc
MD
122.\}
123.rm #[ #] #H #V #F C
8b0cefbb
JR
124.\" ========================================================================
125.\"
126.IX Title "BIO_ctrl 3"
e3261593 127.TH BIO_ctrl 3 "2012-01-04" "1.0.0f" "OpenSSL"
e257b235
PA
128.\" For nroff, turn off justification. Always turn off hyphenation; it makes
129.\" way too many mistakes in technical documents.
130.if n .ad l
131.nh
984263bc
MD
132.SH "NAME"
133BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset,
134BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close,
135BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending,
74dab6c2 136BIO_get_info_callback, BIO_set_info_callback \- BIO control operations
984263bc 137.SH "SYNOPSIS"
8b0cefbb 138.IX Header "SYNOPSIS"
984263bc
MD
139.Vb 1
140\& #include <openssl/bio.h>
e257b235 141\&
984263bc
MD
142\& long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg);
143\& long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long));
144\& char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg);
145\& long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg);
e257b235 146\&
984263bc
MD
147\& int BIO_reset(BIO *b);
148\& int BIO_seek(BIO *b, int ofs);
149\& int BIO_tell(BIO *b);
150\& int BIO_flush(BIO *b);
151\& int BIO_eof(BIO *b);
152\& int BIO_set_close(BIO *b,long flag);
153\& int BIO_get_close(BIO *b);
154\& int BIO_pending(BIO *b);
155\& int BIO_wpending(BIO *b);
156\& size_t BIO_ctrl_pending(BIO *b);
157\& size_t BIO_ctrl_wpending(BIO *b);
e257b235 158\&
984263bc
MD
159\& int BIO_get_info_callback(BIO *b,bio_info_cb **cbp);
160\& int BIO_set_info_callback(BIO *b,bio_info_cb *cb);
e257b235 161\&
984263bc
MD
162\& typedef void bio_info_cb(BIO *b, int oper, const char *ptr, int arg1, long arg2, long arg3);
163.Ve
164.SH "DESCRIPTION"
8b0cefbb
JR
165.IX Header "DESCRIPTION"
166\&\fIBIO_ctrl()\fR, \fIBIO_callback_ctrl()\fR, \fIBIO_ptr_ctrl()\fR and \fIBIO_int_ctrl()\fR
167are \s-1BIO\s0 \*(L"control\*(R" operations taking arguments of various types.
984263bc
MD
168These functions are not normally called directly, various macros
169are used instead. The standard macros are described below, macros
8b0cefbb 170specific to a particular type of \s-1BIO\s0 are described in the specific
984263bc
MD
171BIOs manual page as well as any special features of the standard
172calls.
173.PP
8b0cefbb 174\&\fIBIO_reset()\fR typically resets a \s-1BIO\s0 to some initial state, in the case
984263bc
MD
175of file related BIOs for example it rewinds the file pointer to the
176start of the file.
177.PP
8b0cefbb
JR
178\&\fIBIO_seek()\fR resets a file related \s-1BIO\s0's (that is file descriptor and
179\&\s-1FILE\s0 BIOs) file position pointer to \fBofs\fR bytes from start of file.
984263bc 180.PP
8b0cefbb 181\&\fIBIO_tell()\fR returns the current file position of a file related \s-1BIO\s0.
984263bc 182.PP
8b0cefbb
JR
183\&\fIBIO_flush()\fR normally writes out any internally buffered data, in some
184cases it is used to signal \s-1EOF\s0 and that no more data will be written.
984263bc 185.PP
8b0cefbb
JR
186\&\fIBIO_eof()\fR returns 1 if the \s-1BIO\s0 has read \s-1EOF\s0, the precise meaning of
187\&\*(L"\s-1EOF\s0\*(R" varies according to the \s-1BIO\s0 type.
984263bc 188.PP
8b0cefbb
JR
189\&\fIBIO_set_close()\fR sets the \s-1BIO\s0 \fBb\fR close flag to \fBflag\fR. \fBflag\fR can
190take the value \s-1BIO_CLOSE\s0 or \s-1BIO_NOCLOSE\s0. Typically \s-1BIO_CLOSE\s0 is used
191in a source/sink \s-1BIO\s0 to indicate that the underlying I/O stream should
192be closed when the \s-1BIO\s0 is freed.
984263bc 193.PP
8b0cefbb 194\&\fIBIO_get_close()\fR returns the BIOs close flag.
984263bc 195.PP
8b0cefbb 196\&\fIBIO_pending()\fR, \fIBIO_ctrl_pending()\fR, \fIBIO_wpending()\fR and \fIBIO_ctrl_wpending()\fR
984263bc
MD
197return the number of pending characters in the BIOs read and write buffers.
198Not all BIOs support these calls. \fIBIO_ctrl_pending()\fR and \fIBIO_ctrl_wpending()\fR
199return a size_t type and are functions, \fIBIO_pending()\fR and \fIBIO_wpending()\fR are
200macros which call \fIBIO_ctrl()\fR.
201.SH "RETURN VALUES"
8b0cefbb
JR
202.IX Header "RETURN VALUES"
203\&\fIBIO_reset()\fR normally returns 1 for success and 0 or \-1 for failure. File
984263bc
MD
204BIOs are an exception, they return 0 for success and \-1 for failure.
205.PP
8b0cefbb 206\&\fIBIO_seek()\fR and \fIBIO_tell()\fR both return the current file position on success
984263bc
MD
207and \-1 for failure, except file BIOs which for \fIBIO_seek()\fR always return 0
208for success and \-1 for failure.
209.PP
8b0cefbb 210\&\fIBIO_flush()\fR returns 1 for success and 0 or \-1 for failure.
984263bc 211.PP
8b0cefbb 212\&\fIBIO_eof()\fR returns 1 if \s-1EOF\s0 has been reached 0 otherwise.
984263bc 213.PP
8b0cefbb 214\&\fIBIO_set_close()\fR always returns 1.
984263bc 215.PP
8b0cefbb 216\&\fIBIO_get_close()\fR returns the close flag value: \s-1BIO_CLOSE\s0 or \s-1BIO_NOCLOSE\s0.
984263bc 217.PP
8b0cefbb 218\&\fIBIO_pending()\fR, \fIBIO_ctrl_pending()\fR, \fIBIO_wpending()\fR and \fIBIO_ctrl_wpending()\fR
984263bc
MD
219return the amount of pending data.
220.SH "NOTES"
8b0cefbb
JR
221.IX Header "NOTES"
222\&\fIBIO_flush()\fR, because it can write data may return 0 or \-1 indicating
984263bc
MD
223that the call should be retried later in a similar manner to \fIBIO_write()\fR.
224The \fIBIO_should_retry()\fR call should be used and appropriate action taken
225is the call fails.
226.PP
227The return values of \fIBIO_pending()\fR and \fIBIO_wpending()\fR may not reliably
228determine the amount of pending data in all cases. For example in the
8b0cefbb 229case of a file \s-1BIO\s0 some data may be available in the \s-1FILE\s0 structures
984263bc 230internal buffers but it is not possible to determine this in a
8b0cefbb 231portably way. For other types of \s-1BIO\s0 they may not be supported.
984263bc
MD
232.PP
233Filter BIOs if they do not internally handle a particular \fIBIO_ctrl()\fR
8b0cefbb
JR
234operation usually pass the operation to the next \s-1BIO\s0 in the chain.
235This often means there is no need to locate the required \s-1BIO\s0 for
984263bc 236a particular operation, it can be called on a chain and it will
8b0cefbb 237be automatically passed to the relevant \s-1BIO\s0. However this can cause
984263bc 238unexpected results: for example no current filter BIOs implement
8b0cefbb
JR
239\&\fIBIO_seek()\fR, but this may still succeed if the chain ends in a \s-1FILE\s0
240or file descriptor \s-1BIO\s0.
984263bc
MD
241.PP
242Source/sink BIOs return an 0 if they do not recognize the \fIBIO_ctrl()\fR
243operation.
244.SH "BUGS"
8b0cefbb 245.IX Header "BUGS"
984263bc
MD
246Some of the return values are ambiguous and care should be taken. In
247particular a return value of 0 can be returned if an operation is not
8b0cefbb 248supported, if an error occurred, if \s-1EOF\s0 has not been reached and in
e257b235 249the case of \fIBIO_seek()\fR on a file \s-1BIO\s0 for a successful operation.
984263bc
MD
250.SH "SEE ALSO"
251.IX Header "SEE ALSO"
8b0cefbb 252\&\s-1TBA\s0