Skip to content

Commit

Permalink
feat: add additional pxd defs for message (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Oct 28, 2022
1 parent bed7714 commit 3eb123b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/dbus_fast/aio/proxy_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

from .. import introspection as intr
from .._private.util import replace_fds_with_idx, replace_idx_with_fds
from ..constants import ErrorType
from ..constants import ErrorType, MessageFlag
from ..errors import DBusError
from ..message import Message, MessageFlag
from ..message import Message
from ..message_bus import BaseMessageBus
from ..proxy_object import BaseProxyInterface, BaseProxyObject
from ..signature import Variant
Expand Down
42 changes: 33 additions & 9 deletions src/dbus_fast/message.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,45 @@
import cython


cdef object ErrorType
cdef object SignatureTree
cdef object SignatureType
cdef object MessageType
cdef object Variant
cdef object Marshaller


cdef object HEADER_PATH
cdef object HEADER_INTERFACE
cdef object HEADER_MEMBER
cdef object HEADER_ERROR_NAME
cdef object HEADER_REPLY_SERIAL
cdef object HEADER_DESTINATION
cdef object HEADER_SENDER
cdef object HEADER_SIGNATURE
cdef object HEADER_UNIX_FDS


cdef object LITTLE_ENDIAN
cdef object PROTOCOL_VERSION

cdef get_signature_tree

cdef class Message:

cdef public str destination
cdef public str path
cdef public str interface
cdef public str member
cdef public object destination
cdef public object path
cdef public object interface
cdef public object member
cdef public object message_type
cdef public object flags
cdef public str error_name
cdef public object error_name
cdef public unsigned int reply_serial
cdef public str sender
cdef public list unix_fds
cdef public str signature
cdef public object sender
cdef public object unix_fds
cdef public object signature
cdef public object signature_tree
cdef public list body
cdef public object body
cdef public unsigned int serial

cpdef _marshall(self, bint negotiate_unix_fd)
28 changes: 8 additions & 20 deletions src/dbus_fast/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,33 +266,21 @@ def _marshall(self, negotiate_unix_fd: bool) -> bytearray:
# Variant is invalid.

if self.path:
fields.append([HEADER_PATH, Variant("o", self.path, verify=False)])
fields.append([HEADER_PATH, Variant("o", self.path, False)])
if self.interface:
fields.append(
[HEADER_INTERFACE, Variant("s", self.interface, verify=False)]
)
fields.append([HEADER_INTERFACE, Variant("s", self.interface, False)])
if self.member:
fields.append([HEADER_MEMBER, Variant("s", self.member, verify=False)])
fields.append([HEADER_MEMBER, Variant("s", self.member, False)])
if self.error_name:
fields.append(
[HEADER_ERROR_NAME, Variant("s", self.error_name, verify=False)]
)
fields.append([HEADER_ERROR_NAME, Variant("s", self.error_name, False)])
if self.reply_serial:
fields.append(
[HEADER_REPLY_SERIAL, Variant("u", self.reply_serial, verify=False)]
)
fields.append([HEADER_REPLY_SERIAL, Variant("u", self.reply_serial, False)])
if self.destination:
fields.append(
[HEADER_DESTINATION, Variant("s", self.destination, verify=False)]
)
fields.append([HEADER_DESTINATION, Variant("s", self.destination, False)])
if self.signature:
fields.append(
[HEADER_SIGNATURE, Variant("g", self.signature, verify=False)]
)
fields.append([HEADER_SIGNATURE, Variant("g", self.signature, False)])
if self.unix_fds and negotiate_unix_fd:
fields.append(
[HEADER_UNIX_FDS, Variant("u", len(self.unix_fds), verify=False)]
)
fields.append([HEADER_UNIX_FDS, Variant("u", len(self.unix_fds), False)])

header_body = [
LITTLE_ENDIAN,
Expand Down

0 comments on commit 3eb123b

Please sign in to comment.