This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
galaxy-tsg-olap-app-protoco…/src/test/java/com/zdjizhi/FlagsTest.java
2023-12-14 10:55:03 +08:00

57 lines
1.7 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.zdjizhi;
import org.junit.Test;
/**
* @author qidaijie
* @Package com.zdjizhi
* @Description:
* @date 2023/4/1810:22
*/
public class FlagsTest {
/*
* 参考资料https://juejin.cn/post/6879226834597691405
*
* 会话标记(实际存储为64位无符号整数32-bit Field标识会话的网络行为日志记录值和如下值通过Bitwise AND(&)操作进行查询和转换:
* 0x00000001 - (1) Asymmetric
* 0x00000002 - (2) Bulky
* 0x00000004 - (4) CBR Streaming
* 0x00000008 - (8) Client is Local
* 0x00000010 - (16) Server is Local
* 0x00000020 - (32) Download
* 0x00000040 - (64) Interactive
* 0x00000080 - (128) Inbound
* 0x00000100 - (256) Outbound
* 0x00000200 - (512) Pseudo Unidirectional
* 0x00000400 - (1024) Streaming
* 0x00000800 - (2048) Unidirectional
* 0x00001000 - (4096) Random looking
* 0x00002000 - (8192) C2S
* 0x00004000 - (16384) S2C
*/
@Test
public void bitwiseAND() {
Long flags = 24712L;
Long clientIsLocal = 8L;
Long serverIsLocal = 16L;
System.out.println("flags & clientIsLocal = " + (flags & clientIsLocal));
System.out.println("flags & serverIsLocal = " + (flags & serverIsLocal)+"\n\n");
flags = 16400L;
System.out.println("flags & clientIsLocal = " + (flags & clientIsLocal));
System.out.println("flags & serverIsLocal = " + (flags & serverIsLocal)+"\n\n");
flags = 24712L;
System.out.println("flags & c2s = " + (flags & 8192));
System.out.println("flags & s2c = " + (flags & 16384));
System.out.println("flags & Bidirectional = " + (flags & 32768));
}
}