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