evanslai/pyieee1905

Create M1 payload

Opened this issue · 1 comments

Hi, I'm trying to add the payload to WSC TLV class:

# WSC TLV (0x11)
class WSC(IEEE1905_TLV):
    name = "WSC TLV"
    fields_desc = [
        XByteField("type", 0x11),
        XShortField("len", None),
        FieldLenField("wsc_frame_size", None, count_of="wsc_frame"),
        FieldListField("wsc_frame", None, XByteField("byte", None),
                       count_from=lambda p:p.wsc_frame_size)
    ]

First of all, the field "wsc_frame_size"... I think maybe it should be removed, because I don't get from reading the MultiAP specification or IEEE1905 that this field should exist. And it's logical to me, because there are no meaning of add another length when the length value of the WSC TLV is enough to parse the packet. What do you think about it?

Next, the core of my issue is about adding the M1 or M2 inside the payload. There I think we have different ways to do it.

I think that maybe the best way is to create a TLV for each M1/M2 property (which are, in deffinition, TLV strutures and some of them are shared between M1 and M2). Then, when I want to create an M1 or M2 message, I should add by layers one by one TLV needed and load its properties. So, in this scenario, here is the question:

How can I add all these layers like the payload of the wsc_frame?

Because, if i do:

msg = MultiAP_Message()
msg.msg_type = "AP_AUTOCONFIGURATION_WSC_MESSAGE"

ap_basic_tlv = APRadioBasicCaps()
wsc_tlv = WSC()

CMDU = msg/ap_radio_id_tlv/wsc_tlv/M1_TLV1/M1_TLV2/..../M1_TLN/b"\x00\x00\x00"

I'll get that length in the wsc_tlv is zero (and should be the length of all the M1_TLVs concatenated) and all the M1_TLV1/M1_TLV2/..../M1_TLN not associated with "wsc_frame" field of the WSC TLV.

Any suggetion is welcome.

Thanks in advance.

Pablo.

I think I've found a way, I'll share my experience when I finish my tests.