Skip to content

Expose some DTLS-related features #1026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Nov 2, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Expose DTLS MTU-related functions
  • Loading branch information
njsmith committed Oct 27, 2021
commit 7df5fa9461fe279f70489ee21c7bd85ce7a57f4b
26 changes: 26 additions & 0 deletions src/OpenSSL/SSL.py
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,32 @@ def get_servername(self):

return _ffi.string(name)

def set_ciphertext_mtu(self, mtu):
"""
For DTLS, set the maximum UDP payload size (*not* including IP/UDP
overhead).

Note that you might have to set :data:`OP_NO_QUERY_MTU` to prevent
OpenSSL from spontaneously clearing this.

:param mtu: An integer giving the maximum transmission unit.

.. versionadded:: 21.0
"""
_lib.SSL_set_mtu(self._ssl, mtu)

def get_cleartext_mtu(self):
"""
For DTLS, get the maximum size of unencrypted data you can pass to
:meth:`write` without exceeding the MTU (as passed to
:meth:`set_ciphertext_mtu`).

:return: The effective MTU as an integer.

.. versionadded:: 21.0
"""
return _lib.DTLS_get_data_mtu(self._ssl)

def set_tlsext_host_name(self, name):
"""
Set the value of the servername extension to send in the client hello.
Expand Down