Wave-Net / wavenet-backend

packet capture logic using scapy library
0 stars 0 forks source link

MQTT 핸들러 개선 #14

Closed zhy2on closed 5 months ago

zhy2on commented 5 months ago

CONNECT 패킷

{
    'name': 'MQTT',
    'header': { ... },
    'type': 'CONNECT',
    'connect': {
        'proto_name': ...,
        'mqtt_level': ...,
        'usernameflag': ...,
        'passwordflag': ...,
        'willretainflag': ...,
        'willQOSflag': ...,
        'willflag': ...,
        'cleansession': ...,
        'reserved': ...,
        'keep_alive': ...,
        'clientId': ...,
        'willtopic': ..., # willflag가 True일 때만 존재
        'willmsg': ..., # willflag가 True일 때만 존재
        'username': ..., # usernameflag가 True일 때만 존재
        'password': ..., # passwordflag가 True일 때만 존재
    }
}

CONNACK 패킷

{
    'name': 'MQTT',
    'header': { ... },
    'type': 'CONNACK',
    'connack': {
        'ackflag': ...,
        'return_code': ...,
    }
}

PUBLISH 패킷

{
    'name': 'MQTT',
    'header': { ... },
    'type': 'PUBLISH',
    'publish': {
        'topic': ...,
        'msgid': ...,
        'msgvalue': ...,
    }
}

PUBACK 패킷

{
    'name': 'MQTT',
    'header': { ... },
    'type': 'PUBACK',
    'puback': {
        'msgid': ...,
    }
}

PUBREC 패킷

{
    'name': 'MQTT',
    'header': { ... },
    'type': 'PUBREC',
    'pubrec': {
        'msgid': ...,
    }
}

PUBREL 패킷

{
    'name': 'MQTT',
    'header': { ... },
    'type': 'PUBREL',
    'pubrel': {
        'msgid': ...,
    }
}

PUBCOMP 패킷

{
    'name': 'MQTT',
    'header': { ... },
    'type': 'PUBCOMP',
    'pubcomp': {
        'msgid': ...,
    }
}
패킷 타입 구조
CONNECT {'name': 'MQTT', 'header': { ... }, 'type': 'CONNECT', 'connect': { ... }}
CONNACK {'name': 'MQTT', 'header': { ... }, 'type': 'CONNACK', 'connack': { ... }}
PUBLISH {'name': 'MQTT', 'header': { ... }, 'type': 'PUBLISH', 'publish': { ... }}
PUBACK {'name': 'MQTT', 'header': { ... }, 'type': 'PUBACK', 'puback': { ... }}
PUBREC {'name': 'MQTT', 'header': { ... }, 'type': 'PUBREC', 'pubrec': { ... }}
PUBREL {'name': 'MQTT', 'header': { ... }, 'type': 'PUBREL', 'pubrel': { ... }}
PUBCOMP {'name': 'MQTT', 'header': { ... }, 'type': 'PUBCOMP', 'pubcomp': { ... }}