本人只会delphi pascal ,求懂C的帮助解析一段UDP接收的广播消息

mz941 2017-04-10 11:51:22


Connect Indication Attributes
This section describes the attributes contained in the Connect Indication Message.
Attribute: System Type
The System Type attribute describes the type of the system (e.g. Monitor).
Attribute ID: NOM_ATTR_SYS_TYPE
Attribute Type: TYPE (see Definitions Shared by Protocols)
Attribute Groups: -
Availability: -
Attribute: Protocol Support
The Protocol Support contains an entry for each protocol supported on the network interface.
Attribute ID: NOM_ATTR_PCOL_SUPPORT (查开发手册 NOM_ATTR_PCOL_SUPPORT 的值: 0xF101 )
Attribute Type: ProtoSupport
Attribute Groups: -
Availability: -
The ProtoSupport is defined as follows:
typedef struct {
u_16 count;
u_16 length;
ProtoSupportEntry value[1];
} ProtoSupport;
typedef struct {
ApplProtoId appl_proto;
TransProtoId trans_proto;
u_16 port_number;
ProtoOptions options;
} ProtoSupportEntry;
typedef u_16 ApplProtoId;
#define AP_ID_ACSE 1
#define AP_ID_DATA_OUT 5
typedef u_16 TransProtoId;
#define TP_ID_UDP 1
typedef u_16 ProtoOptions;
#define P_OPT_WIRELESS 0x8000
The Computer Client should parse the available protocols and search for the AP_ID_DATA_OUT.
This entry specifies the port for the Data Export Protocol. The corresponding Association Control
Protocol runs on the same port.
The Computer Client must only send requests to the port specified for the Data Export Protocol.
00 00 01 00 00 01 01 70 00 00 00 00 01 6A 00 23 00 00 00 00 00 01 00 00 0D 17 01 5C 00 0D 01 58 09 20 00 04 00 03 00 00 09 86 00 04 00 01 11 4D 09 37 00 08 06 08 06 08 00 0D 00 0B F1 36 00 04 00 00 00 00 F2 7C 00 1A 00 01 80 00 00 01 00 12 F1 00 00 0E 00 09 FB 72 13 C0 AC A8 01 64 FF FF FF 00 F1 35 00 22 00 42 00 31 00 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 F1 00 00 0E 00 09 FB 72 13 C0 AC A8 01 64 FF FF FF 00 F1 01 00 2C 00 05 00 28 00 01 00 03 5D C0 00 00 00 02 00 03 5D C0 00 00 00 01 00 01 5E 29 00 00 00 05 00 01 5E 29 00 00 00 0A 00 01 5D CC 00 00 F3 5E 00 10 FE 80 00 00 00 00 00 00 02 09 FB FF FE 72 13 C0 09 84 00 0A 00 08 00 09 FB FF FF 72 13 C0 09 2D 00 68 00 06 00 64 00 01 00 08 00 0C 44 45 38 34 33 31 38 34 36 30 00 09 00 02 00 08 00 0E 4D 38 30 30 35 41 00 00 00 00 00 00 00 00 00 03 00 08 00 08 20 42 2E 30 30 2E 32 33 00 05 00 78 00 08 2D 2D 2D 2D 2D 2D 2D 2D 00 02 00 58 00 0E 53 2D 4D 34 30 34 36 2D 31 37 30 31 41 20 00 04 00 58 00 08 48 2E 31 35 2E 34 31 20 09 28 00 14 00 08 50 68 69 6C 69 70 73 00 00 08 4D 38 30 30 35 41 00 00 F1 5A 00 04 00 00 00 02
根据接收的这段16进制消息 怎么分析出UDP的端口号?
...全文
805 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
按照他这个协议 typedef u_16 ProtoOptions; #define P_OPT_WIRELESS 0x8000 之前的一个u_16就是port_number 从你给出的数据看,只可能是0x0001或者0x10fe(因为网络传输通常使用大端字节序)。

1,317

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 网络及通讯开发
社区管理员
  • 网络及通讯开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧