AMF消息结构?

发布于 2024-08-06 21:31:12 字数 238 浏览 5 评论 0原文

Adobe 的 AMF 格式文档 似乎并未实际指定整个AMF消息的结构。它仅指定单个数据类型的格式。我已经读了五遍这该死的东西,要么我完全错过了实际的 AMF 消息应该包含的内容,要么它不存在。有谁知道实际整个消息结构的任何文档?

Adobe's documentation for the AMF format does not seem to actually specify the structure of an entire AMF message. It only specifies the format of individual data types. I've read the damn thing five times and either I'm just totally missing what an actual AMF message should contain, or it's not there. Does anyone know of any documentation of the actual whole-message structure?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

携君以终年 2024-08-13 21:31:12

该规范可以被描述为“简洁”。

AMF 编码使用称为“类型标记”的字节。整数的类型标记是值 4。整数数据紧跟在该标记之后,长度为 1-4 个字节。长度会有所不同,因为整数类型被“压缩”,因此值 0-127 仅需要 1 个字节,而较大的值需要更多字节。该整数格式在规范中称为“U29”。

例如,如果我们简单地传递整数“5”,则有效的 AMF 数据包将是这两个字节:
04 05

在网络上的应用程序中,AMF 数据有时前面有一个按网络字节顺序编码为无符号长整型的长度。如果您正在观察此类应用程序,您可能会看到:
00 00 00 02 04 05,其中00 00 00 02表示后面的AMF数据长度为2字节。

现在,假设我们发送了一个具有以下构造函数的对象:

   this.ui = "button_press";
   this.param = 5;

然后我们可能会在 AMF 数据中看到以下内容:

0A - 对象标记
2B - u29o-val:2 个密封成员,具有特征和数据的对象,可能是动态成员
01 - 空字符串 - 匿名对象
05 - 按值字符串,字符串长度:2
75 69 - 'ui'
0B - 按值字符串,字符串长度:5
70 61 72 61 6D - '参数'
19 - 按值字符串,字符串长度:12
62 75 74 74 6F 6E 5F 70 72 65 73 73 - 'button_press'
04 - 整数
05 - 整数值:5
01 - 空名称,终止此对象的动态成员的空列表

由于该数据包将占用 28 个字节,因此遇到时可能会带有前缀:00 00 00 1C在野外。

另一种需要考虑的可能性是 AMF 通信可以被压缩,通常使用 zlib 中提供的“deflate”压缩。

我希望这可以帮助您理清规范,但如果您有疑问,我会尽力回答。

The specification might be described as "terse."

The AMF encoding uses bytes which are called "type-markers." The type-marker for an integer is the value 4. The integer data immediately follows this tag, and is 1-4 bytes long. The length varies because the integer type is "compressed" so that values 0-127 require only 1 byte, while larger values require more bytes. This integer format is called "U29" by the specification.

As an example, if we were to simply pass the integer "5", a valid AMF packet would be these two bytes:
04 05

In applications found on the web, the AMF data is sometimes preceded by a length encoded as an unsigned long in network byte order. If you were observing such an application, you might see:
00 00 00 02 04 05, where the 00 00 00 02 indicates that the following AMF data is 2 bytes long.

Now, suppose we sent an object after it had the following constructor:

   this.ui = "button_press";
   this.param = 5;

Then we might see the following in the AMF data:

0A - the object tag
2B - u29o-val: 2 sealed members, object with traits and data, possibly dynamic members
01 - empty string -- anonymous object
05 - string-by-value, string length: 2
75 69 - 'ui'
0B - string-by-value, string length: 5
70 61 72 61 6D - 'param'
19 - string-by-value, string length: 12
62 75 74 74 6F 6E 5F 70 72 65 73 73 - 'button_press'
04 - integer
05 - value of integer: 5
01 - empty name, terminates empty list of dynamic members this object

Since that packet will take 28 bytes, it may be prefixed by: 00 00 00 1C when encountered in the wild.

Another possibility to consider is that AMF communications may be compressed, typically using the "deflate" compression available in zlib.

I hope this helps you sort out the specification, but if you have questions, I would try to answer them.

只是在用心讲痛 2024-08-13 21:31:12

如果您正在寻找远程消息结构,它将附加到 的末尾AMF0 规范 - 第 4 节

If you are looking for remoting message structure it is appended to the end of the AMF0 spec - Section 4

葬﹪忆之殇 2024-08-13 21:31:12

您还可以浏览 wiki http://en.wikipedia.org/wiki/Action_Message_Format
它有足够的所需信息。

谢谢,
拉杰什。

You can also go through wiki http://en.wikipedia.org/wiki/Action_Message_Format
It has enough information needed.

Thanks,
Rajesh.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文