1# SPDX-License-Identifier: GPL-2.0-only
2# This file is part of Scapy
3# See https://scapy.net/ for more information
4# Copyright (C) Philippe Biondi <phil@secdev.org>
5
6"""
7MGCP (Media Gateway Control Protocol)
8
9[RFC 2805]
10"""
11
12from scapy.packet import Packet, bind_layers, bind_bottom_up
13from scapy.fields import StrFixedLenField, StrStopField
14from scapy.layers.inet import UDP
15
16
17class MGCP(Packet):
18 name = "MGCP"
19 longname = "Media Gateway Control Protocol"
20 fields_desc = [StrStopField("verb", "AUEP", b" ", -1),
21 StrFixedLenField("sep1", " ", 1),
22 StrStopField("transaction_id", "1234567", b" ", -1),
23 StrFixedLenField("sep2", " ", 1),
24 StrStopField("endpoint", "dummy@dummy.net", b" ", -1),
25 StrFixedLenField("sep3", " ", 1),
26 StrStopField("version", "MGCP 1.0 NCS 1.0", b"\x0a", -1),
27 StrFixedLenField("sep4", b"\x0a", 1),
28 ]
29
30
31# class MGCP(Packet):
32# name = "MGCP"
33# longname = "Media Gateway Control Protocol"
34# fields_desc = [ ByteEnumField("type",0, ["request","response","others"]),
35# ByteField("code0",0),
36# ByteField("code1",0),
37# ByteField("code2",0),
38# ByteField("code3",0),
39# ByteField("code4",0),
40# IntField("trasid",0),
41# IntField("req_time",0),
42# ByteField("is_duplicate",0),
43# ByteField("req_available",0) ]
44#
45bind_bottom_up(UDP, MGCP, dport=2727)
46bind_bottom_up(UDP, MGCP, sport=2727)
47bind_layers(UDP, MGCP, sport=2727, dport=2727)