~exarkun/pyopenssl/trunk

« back to all changes in this revision

Viewing changes to OpenSSL/ssl/connection.c

  • Committer: Jean-Paul Calderone
  • Date: 2011-09-11 19:49:43 UTC
  • mfrom: (156.3.22 sphinx-doc)
  • Revision ID: exarkun@divmod.com-20110911194943-ucaan2tzidk7ek5l
Convert the documentation from LaTeX/epytext to Sphinx/ReST

Show diffs side-by-side

added added

removed removed

Lines of Context:
251
251
static char ssl_Connection_get_context_doc[] = "\n\
252
252
Get session context\n\
253
253
\n\
254
 
@return: A Context object\n\
 
254
:return: A Context object\n\
255
255
";
256
256
static PyObject *
257
257
ssl_Connection_get_context(ssl_ConnectionObj *self, PyObject *args) {
266
266
static char ssl_Connection_set_context_doc[] = "\n\
267
267
Switch this connection to a new session context\n\
268
268
\n\
269
 
@param context: A L{Context} instance giving the new session context to use.\n\
 
269
:param context: A :py:class:`Context` instance giving the new session context to use.\n\
270
270
\n\
271
271
";
272
272
static PyObject *
305
305
Retrieve the servername extension value if provided in the client hello\n\
306
306
message, or None if there wasn't one.\n\
307
307
\n\
308
 
@return: A byte string giving the server name or C{None}.\n\
 
308
:return: A byte string giving the server name or :py:data:`None`.\n\
309
309
\n\
310
310
";
311
311
static PyObject *
331
331
static char ssl_Connection_set_tlsext_host_name_doc[] = "\n\
332
332
Set the value of the servername extension to send in the client hello.\n\
333
333
\n\
334
 
@param name: A byte string giving the name.\n\
 
334
:param name: A byte string giving the name.\n\
335
335
\n\
336
336
";
337
337
static PyObject *
354
354
static char ssl_Connection_pending_doc[] = "\n\
355
355
Get the number of bytes that can be safely read from the connection\n\
356
356
\n\
357
 
@return: The number of bytes available in the receive buffer.\n\
 
357
:return: The number of bytes available in the receive buffer.\n\
358
358
";
359
359
static PyObject *
360
360
ssl_Connection_pending(ssl_ConnectionObj *self, PyObject *args) {
372
372
When using non-socket connections this function sends\n\
373
373
\"dirty\" data that would have traveled in on the network.\n\
374
374
\n\
375
 
@param buf: The string to put into the memory BIO.\n\
376
 
@return: The number of bytes written\n\
 
375
:param buf: The string to put into the memory BIO.\n\
 
376
:return: The number of bytes written\n\
377
377
";
378
378
static PyObject *
379
379
ssl_Connection_bio_write(ssl_ConnectionObj *self, PyObject *args)
414
414
WantWrite or WantX509Lookup exceptions on this, you have to call the\n\
415
415
method again with the SAME buffer.\n\
416
416
\n\
417
 
@param buf: The string to send\n\
418
 
@param flags: (optional) Included for compatibility with the socket\n\
 
417
:param buf: The string to send\n\
 
418
:param flags: (optional) Included for compatibility with the socket\n\
419
419
              API, the value is ignored\n\
420
 
@return: The number of bytes written\n\
 
420
:return: The number of bytes written\n\
421
421
";
422
422
static PyObject *
423
423
ssl_Connection_send(ssl_ConnectionObj *self, PyObject *args) {
469
469
all data is sent. If an error occurs, it's impossible to tell how much data\n\
470
470
has been sent.\n\
471
471
\n\
472
 
@param buf: The string to send\n\
473
 
@param flags: (optional) Included for compatibility with the socket\n\
 
472
:param buf: The string to send\n\
 
473
:param flags: (optional) Included for compatibility with the socket\n\
474
474
              API, the value is ignored\n\
475
 
@return: The number of bytes written\n\
 
475
:return: The number of bytes written\n\
476
476
";
477
477
static PyObject *
478
478
ssl_Connection_sendall(ssl_ConnectionObj *self, PyObject *args)
532
532
WantWrite or WantX509Lookup exceptions on this, you have to call the\n\
533
533
method again with the SAME buffer.\n\
534
534
\n\
535
 
@param bufsiz: The maximum number of bytes to read\n\
536
 
@param flags: (optional) Included for compatibility with the socket\n\
 
535
:param bufsiz: The maximum number of bytes to read\n\
 
536
:param flags: (optional) Included for compatibility with the socket\n\
537
537
              API, the value is ignored\n\
538
 
@return: The string read from the Connection\n\
 
538
:return: The string read from the Connection\n\
539
539
";
540
540
static PyObject *
541
541
ssl_Connection_recv(ssl_ConnectionObj *self, PyObject *args)
580
580
When using non-socket connections this function reads\n\
581
581
the \"dirty\" data that would have traveled away on the network.\n\
582
582
\n\
583
 
@param bufsiz: The maximum number of bytes to read\n\
584
 
@return: The string read.\n\
 
583
:param bufsiz: The maximum number of bytes to read\n\
 
584
:return: The string read.\n\
585
585
";
586
586
static PyObject *
587
587
ssl_Connection_bio_read(ssl_ConnectionObj *self, PyObject *args)
634
634
static char ssl_Connection_renegotiate_doc[] = "\n\
635
635
Renegotiate the session\n\
636
636
\n\
637
 
@return: True if the renegotiation can be started, false otherwise\n\
 
637
:return: True if the renegotiation can be started, false otherwise\n\
638
638
";
639
639
static PyObject *
640
640
ssl_Connection_renegotiate(ssl_ConnectionObj *self, PyObject *args) {
660
660
Perform an SSL handshake (usually called after renegotiate() or one of\n\
661
661
set_*_state()). This can raise the same exceptions as send and recv.\n\
662
662
\n\
663
 
@return: None.\n\
 
663
:return: None.\n\
664
664
";
665
665
static PyObject *
666
666
ssl_Connection_do_handshake(ssl_ConnectionObj *self, PyObject *args)
698
698
Check if there's a renegotiation in progress, it will return false once\n\
699
699
a renegotiation is finished.\n\
700
700
\n\
701
 
@return: Whether there's a renegotiation in progress\n\
 
701
:return: Whether there's a renegotiation in progress\n\
702
702
";
703
703
static PyObject *
704
704
ssl_Connection_renegotiate_pending(ssl_ConnectionObj *self, PyObject *args)
713
713
static char ssl_Connection_total_renegotiations_doc[] = "\n\
714
714
Find out the total number of renegotiations.\n\
715
715
\n\
716
 
@return: The number of renegotiations.\n\
 
716
:return: The number of renegotiations.\n\
717
717
";
718
718
static PyObject *
719
719
ssl_Connection_total_renegotiations(ssl_ConnectionObj *self, PyObject *args)
728
728
Set the connection to work in server mode. The handshake will be handled\n\
729
729
automatically by read/write.\n\
730
730
\n\
731
 
@return: None\n\
 
731
:return: None\n\
732
732
";
733
733
static PyObject *
734
734
ssl_Connection_set_accept_state(ssl_ConnectionObj *self, PyObject *args)
746
746
Set the connection to work in client mode. The handshake will be handled\n\
747
747
automatically by read/write.\n\
748
748
\n\
749
 
@return: None\n\
 
749
:return: None\n\
750
750
";
751
751
static PyObject *
752
752
ssl_Connection_set_connect_state(ssl_ConnectionObj *self, PyObject *args)
763
763
static char ssl_Connection_connect_doc[] = "\n\
764
764
Connect to remote host and set up client-side SSL\n\
765
765
\n\
766
 
@param addr: A remote address\n\
767
 
@return: What the socket's connect method returns\n\
 
766
:param addr: A remote address\n\
 
767
:return: What the socket's connect method returns\n\
768
768
";
769
769
static PyObject *
770
770
ssl_Connection_connect(ssl_ConnectionObj *self, PyObject *args)
788
788
Connect to remote host and set up client-side SSL. Note that if the socket's\n\
789
789
connect_ex method doesn't return 0, SSL won't be initialized.\n\
790
790
\n\
791
 
@param addr: A remove address\n\
792
 
@return: What the socket's connect_ex method returns\n\
 
791
:param addr: A remove address\n\
 
792
:return: What the socket's connect_ex method returns\n\
793
793
";
794
794
static PyObject *
795
795
ssl_Connection_connect_ex(ssl_ConnectionObj *self, PyObject *args)
809
809
static char ssl_Connection_accept_doc[] = "\n\
810
810
Accept incoming connection and set up SSL on it\n\
811
811
\n\
812
 
@return: A (conn,addr) pair where conn is a Connection and addr is an\n\
 
812
:return: A (conn,addr) pair where conn is a Connection and addr is an\n\
813
813
         address\n\
814
814
";
815
815
static PyObject *
853
853
When using non-socket connections this function signals end of\n\
854
854
data on the input for this connection.\n\
855
855
\n\
856
 
@return: None\n\
 
856
:return: None\n\
857
857
";
858
858
 
859
859
static PyObject *
875
875
static char ssl_Connection_shutdown_doc[] = "\n\
876
876
Send closure alert\n\
877
877
\n\
878
 
@return: True if the shutdown completed successfully (i.e. both sides\n\
 
878
:return: True if the shutdown completed successfully (i.e. both sides\n\
879
879
         have sent closure alerts), false otherwise (i.e. you have to\n\
880
880
         wait for a ZeroReturnError on a recv() method call\n\
881
881
";
917
917
static char ssl_Connection_get_cipher_list_doc[] = "\n\
918
918
Get the session cipher list\n\
919
919
\n\
920
 
@return: A list of cipher strings\n\
 
920
:return: A list of cipher strings\n\
921
921
";
922
922
static PyObject *
923
923
ssl_Connection_get_cipher_list(ssl_ConnectionObj *self, PyObject *args)
943
943
static char ssl_Connection_get_client_ca_list_doc[] = "\n\
944
944
Get CAs whose certificates are suggested for client authentication.\n\
945
945
\n\
946
 
@return: If this is a server connection, a list of X509Names representing\n\
947
 
    the acceptable CAs as set by L{OpenSSL.SSL.Context.set_client_ca_list} or\n\
948
 
    L{OpenSSL.SSL.Context.add_client_ca}.  If this is a client connection,\n\
 
946
:return: If this is a server connection, a list of X509Names representing\n\
 
947
    the acceptable CAs as set by :py:meth:`OpenSSL.SSL.Context.set_client_ca_list` or\n\
 
948
    :py:meth:`OpenSSL.SSL.Context.add_client_ca`.  If this is a client connection,\n\
949
949
    the list of such X509Names sent by the server, or an empty list if that\n\
950
950
    has not yet happened.\n\
951
951
";
997
997
The makefile() method is not implemented, since there is no dup semantics\n\
998
998
for SSL connections\n\
999
999
\n\
1000
 
@raise NotImplementedError\n\
 
1000
:raise NotImplementedError\n\
1001
1001
";
1002
1002
static PyObject *
1003
1003
ssl_Connection_makefile(ssl_ConnectionObj *self, PyObject *args)
1009
1009
static char ssl_Connection_get_app_data_doc[] = "\n\
1010
1010
Get application data\n\
1011
1011
\n\
1012
 
@return: The application data\n\
 
1012
:return: The application data\n\
1013
1013
";
1014
1014
static PyObject *
1015
1015
ssl_Connection_get_app_data(ssl_ConnectionObj *self, PyObject *args)
1024
1024
static char ssl_Connection_set_app_data_doc[] = "\n\
1025
1025
Set application data\n\
1026
1026
\n\
1027
 
@param data - The application data\n\
1028
 
@return: None\n\
 
1027
:param data - The application data\n\
 
1028
:return: None\n\
1029
1029
";
1030
1030
static PyObject *
1031
1031
ssl_Connection_set_app_data(ssl_ConnectionObj *self, PyObject *args)
1046
1046
static char ssl_Connection_get_shutdown_doc[] = "\n\
1047
1047
Get shutdown state\n\
1048
1048
\n\
1049
 
@return: The shutdown state, a bitvector of SENT_SHUTDOWN, RECEIVED_SHUTDOWN.\n\
 
1049
:return: The shutdown state, a bitvector of SENT_SHUTDOWN, RECEIVED_SHUTDOWN.\n\
1050
1050
";
1051
1051
static PyObject *
1052
1052
ssl_Connection_get_shutdown(ssl_ConnectionObj *self, PyObject *args)
1060
1060
static char ssl_Connection_set_shutdown_doc[] = "\n\
1061
1061
Set shutdown state\n\
1062
1062
\n\
1063
 
@param state - bitvector of SENT_SHUTDOWN, RECEIVED_SHUTDOWN.\n\
1064
 
@return: None\n\
 
1063
:param state - bitvector of SENT_SHUTDOWN, RECEIVED_SHUTDOWN.\n\
 
1064
:return: None\n\
1065
1065
";
1066
1066
static PyObject *
1067
1067
ssl_Connection_set_shutdown(ssl_ConnectionObj *self, PyObject *args)
1079
1079
static char ssl_Connection_state_string_doc[] = "\n\
1080
1080
Get a verbose state description\n\
1081
1081
\n\
1082
 
@return: A string representing the state\n\
 
1082
:return: A string representing the state\n\
1083
1083
";
1084
1084
static PyObject *
1085
1085
ssl_Connection_state_string(ssl_ConnectionObj *self, PyObject *args)
1093
1093
static char ssl_Connection_client_random_doc[] = "\n\
1094
1094
Get a copy of the client hello nonce.\n\
1095
1095
\n\
1096
 
@return: A string representing the state\n\
 
1096
:return: A string representing the state\n\
1097
1097
";
1098
1098
static PyObject *
1099
1099
ssl_Connection_client_random(ssl_ConnectionObj *self, PyObject *args)
1111
1111
static char ssl_Connection_server_random_doc[] = "\n\
1112
1112
Get a copy of the server hello nonce.\n\
1113
1113
\n\
1114
 
@return: A string representing the state\n\
 
1114
:return: A string representing the state\n\
1115
1115
";
1116
1116
static PyObject *
1117
1117
ssl_Connection_server_random(ssl_ConnectionObj *self, PyObject *args)
1129
1129
static char ssl_Connection_master_key_doc[] = "\n\
1130
1130
Get a copy of the master key.\n\
1131
1131
\n\
1132
 
@return: A string representing the state\n\
 
1132
:return: A string representing the state\n\
1133
1133
";
1134
1134
static PyObject *
1135
1135
ssl_Connection_master_key(ssl_ConnectionObj *self, PyObject *args)
1147
1147
static char ssl_Connection_sock_shutdown_doc[] = "\n\
1148
1148
See shutdown(2)\n\
1149
1149
\n\
1150
 
@return: What the socket's shutdown() method returns\n\
 
1150
:return: What the socket's shutdown() method returns\n\
1151
1151
";
1152
1152
static PyObject *
1153
1153
ssl_Connection_sock_shutdown(ssl_ConnectionObj *self, PyObject *args)
1164
1164
static char ssl_Connection_get_peer_certificate_doc[] = "\n\
1165
1165
Retrieve the other side's certificate (if any)\n\
1166
1166
\n\
1167
 
@return: The peer's certificate\n\
 
1167
:return: The peer's certificate\n\
1168
1168
";
1169
1169
static PyObject *
1170
1170
ssl_Connection_get_peer_certificate(ssl_ConnectionObj *self, PyObject *args)
1189
1189
static char ssl_Connection_get_peer_cert_chain_doc[] = "\n\
1190
1190
Retrieve the other side's certificate (if any)\n\
1191
1191
\n\
1192
 
@return: A list of X509 instances giving the peer's certificate chain,\n\
 
1192
:return: A list of X509 instances giving the peer's certificate chain,\n\
1193
1193
         or None if it does not have one.\n\
1194
1194
";
1195
1195
static PyObject *
1228
1228
Checks if more data has to be read from the transport layer to complete an\n\
1229
1229
operation.\n\
1230
1230
\n\
1231
 
@return: True iff more data has to be read\n\
 
1231
:return: True iff more data has to be read\n\
1232
1232
";
1233
1233
static PyObject *
1234
1234
ssl_Connection_want_read(ssl_ConnectionObj *self, PyObject *args)
1243
1243
Checks if there is data to write to the transport layer to complete an\n\
1244
1244
operation.\n\
1245
1245
\n\
1246
 
@return: True iff there is data to write\n\
 
1246
:return: True iff there is data to write\n\
1247
1247
";
1248
1248
static PyObject *
1249
1249
ssl_Connection_want_write(ssl_ConnectionObj *self, PyObject *args)
1320
1320
Create a new Connection object, using the given OpenSSL.SSL.Context instance\n\
1321
1321
and socket.\n\
1322
1322
\n\
1323
 
@param context: An SSL Context to use for this connection\n\
1324
 
@param socket: The socket to use for transport layer\n\
 
1323
:param context: An SSL Context to use for this connection\n\
 
1324
:param socket: The socket to use for transport layer\n\
1325
1325
";
1326
1326
 
1327
1327
/*