|
21 | 21 | """Network Data Representation (NDR) marshalling and unmarshalling."""
|
22 | 22 |
|
23 | 23 |
|
24 |
| -def ndr_pack(object): |
| 24 | +def ndr_pack(object) -> bytes: |
25 | 25 | """Pack a NDR object.
|
26 | 26 |
|
27 | 27 | :param object: Object to pack
|
28 |
| - :return: String object with marshalled object. |
| 28 | + :return: bytes object with marshalled object. |
29 | 29 | """
|
30 | 30 | ndr_pack = getattr(object, "__ndr_pack__", None)
|
31 | 31 | if ndr_pack is None:
|
32 | 32 | raise TypeError("%r is not a NDR object" % object)
|
33 | 33 | return ndr_pack()
|
34 | 34 |
|
35 | 35 |
|
36 |
| -def ndr_unpack(cls, data, allow_remaining=False): |
| 36 | +def ndr_unpack(cls, data:bytes, allow_remaining=False): |
37 | 37 | """NDR unpack an object.
|
38 | 38 |
|
39 | 39 | :param cls: Class of the object to unpack
|
@@ -75,21 +75,25 @@ def ndr_deepcopy(object):
|
75 | 75 | return copy
|
76 | 76 |
|
77 | 77 |
|
78 |
| -def ndr_pack_in(object, bigendian=False, ndr64=False): |
| 78 | +def ndr_pack_in(object, bigendian=False, ndr64=False) -> bytes: |
79 | 79 | """Pack the input of an NDR function object.
|
80 | 80 |
|
81 | 81 | :param object: Object to pack
|
82 | 82 | :param bigendian: use LIBNDR_FLAG_BIGENDIAN (default=False)
|
83 | 83 | :param ndr64: use LIBNDR_FLAG_NDR64 (default=False)
|
84 |
| - :return: String object with marshalled object. |
| 84 | + :return: bytes object with marshalled object. |
85 | 85 | """
|
86 | 86 | ndr_pack_in_fn = getattr(object, "__ndr_pack_in__", None)
|
87 | 87 | if ndr_pack_in_fn is None:
|
88 | 88 | raise TypeError("%r is not a NDR function object" % object)
|
89 | 89 | return ndr_pack_in_fn(bigendian=bigendian, ndr64=ndr64)
|
90 | 90 |
|
91 | 91 |
|
92 |
| -def ndr_unpack_in(object, data, bigendian=False, ndr64=False, allow_remaining=False): |
| 92 | +def ndr_unpack_in(object, |
| 93 | + data: bytes, |
| 94 | + bigendian=False, |
| 95 | + ndr64=False, |
| 96 | + allow_remaining=False): |
93 | 97 | """Unpack the input of an NDR function object.
|
94 | 98 |
|
95 | 99 | :param cls: Class of the object to unpack
|
|
0 commit comments