Skip to content
This repository was archived by the owner on Jan 27, 2021. It is now read-only.
This repository was archived by the owner on Jan 27, 2021. It is now read-only.

__ser and __deser force datatype to be 8bytes. Cannot send custom packets over network wire #77

@prpr2770

Description

@prpr2770

While using Ivy for networking, based on udp_impl.ivy, I found that using the following definition of a packet:

type packet
interpret packet -> bv[16]
instance pkt_serdes : serdes(packet,bytes, ivy_binary_ser, ivy_binary_deser)
instance net : udp_impl(endpoint_id, packet, ivy_binary_ser, ivy_binary_deser)

Enables, transmitting random messages of 8bytes, with only 2bytes(16bits) that is randomly initialized, while the 6 bytes are initialized to 0x00.
The destination thus receives, 8bytes in total, rather than the expected 2bytes.

While trying to debug this issue, I found that the following script for compilation:
/ivy/ivy_to_cpp.py provides the following description for __ser:

template <class T> void __ser(ivy_ser &res, const T &inp);
template <>
void __ser<int>(ivy_ser &res, const int &inp) {
    res.set((long long)inp);
}

Which suggests that the packet is interpreted to be a long long. Is there a way, to ensure that the __ser and __deser, can be modified so that randomized data-packets of length 16bits can be generated, and no extra-padding bytes are sent on the wire?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions