File: ZhttpServerOptions.py

package info (click to toggle)
czmq 4.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,912 kB
  • sloc: ansic: 30,811; cpp: 19,362; sh: 11,873; python: 11,814; pascal: 11,229; ruby: 8,818; java: 4,363; makefile: 299; perl: 151; javascript: 35
file content (68 lines) | stat: -rw-r--r-- 2,411 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
################################################################################
#  THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY  #
#  Read the zproject/README.md for information about making permanent changes. #
################################################################################
from . import utils
from . import destructors
libczmq_destructors = destructors.lib

class ZhttpServerOptions(object):
    """
    zhttp server.
    """

    def __init__(self):
        """
        Create a new zhttp_server_options.
        """
        p = utils.lib.zhttp_server_options_new()
        if p == utils.ffi.NULL:
            raise MemoryError("Could not allocate person")

        # ffi.gc returns a copy of the cdata object which will have the
        # destructor called when the Python object is GC'd:
        # https://cffi.readthedocs.org/en/latest/using.html#ffi-interface
        self._p = utils.ffi.gc(p, libczmq_destructors.zhttp_server_options_destroy_py)

    @staticmethod
    def from_config(config):
        """
        Create options from config tree.
        """
        return utils.lib.zhttp_server_options_from_config(config._p)

    def port(self):
        """
        Get the server listening port.
        """
        return utils.lib.zhttp_server_options_port(self._p)

    def set_port(self, port):
        """
        Set the server listening port
        """
        utils.lib.zhttp_server_options_set_port(self._p, port)

    def backend_address(self):
        """
        Get the address sockets should connect to in order to receive requests.
        """
        return utils.lib.zhttp_server_options_backend_address(self._p)

    def set_backend_address(self, address):
        """
        Set the address sockets should connect to in order to receive requests.
        """
        utils.lib.zhttp_server_options_set_backend_address(self._p, utils.to_bytes(address))

    @staticmethod
    def test(verbose):
        """
        Self test of this class.
        """
        utils.lib.zhttp_server_options_test(verbose)

################################################################################
#  THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY  #
#  Read the zproject/README.md for information about making permanent changes. #
################################################################################