示例#1
0
 /// <summary>
 /// Gets whether or not given ipv4 header has the more fragments flag set.
 /// </summary>
 /// <param name="hdr">
 /// The ipv4 header.
 /// </param>
 /// <returns>
 /// True if the given ipv4 has the more fragments flag set, false otherwise.
 /// </returns>
 public static bool WINDIVERT_IPHDR_GET_MF(WINDIVERT_IPHDR hdr)
 {
     return((ushort)(hdr.FragOff0 & 0x0020) != 0);
 }
示例#2
0
 /// <summary>
 /// Gets the fragment offset for the given ipv4 header.
 /// </summary>
 /// <param name="hdr">
 /// The ipv4 header.
 /// </param>
 /// <returns>
 /// The extracted fragment offset from the given ipv4 header.
 /// </returns>
 public static ushort WINDIVERT_IPHDR_GET_FRAGOFF(WINDIVERT_IPHDR hdr)
 {
     return((ushort)(hdr.FragOff0 & 0xFF1F));
 }
示例#3
0
 /// <summary>
 /// Sets the reserved flag to the given value.
 /// </summary>
 /// <param name="header">
 /// The ipv4 header.
 /// </param>
 /// <param name="val">
 /// The reserved flag value.
 /// </param>
 public static void WINDIVERT_IPHDR_SET_RESERVED(WINDIVERT_IPHDR header, ushort val)
 {
     header.FragOff0 = (ushort)((header.FragOff0 & 0xFF7F) | ((val & 0x0001) << 7));
 }
示例#4
0
 /// <summary>
 /// Sets the don't fragment flag to the given value.
 /// </summary>
 /// <param name="header">
 /// The ipv4 header.
 /// </param>
 /// <param name="val">
 /// The don't fragment flag value.
 /// </param>
 public static void WINDIVERT_IPHDR_SET_DF(WINDIVERT_IPHDR header, ushort val)
 {
     header.FragOff0 = (ushort)((header.FragOff0 & 0xFFBF) | ((val & 0x0001) << 6));
 }
示例#5
0
 /// <summary>
 /// Sets the fragment offset for the given ipv4 header.
 /// </summary>
 /// <param name="header">
 /// The ipv4 header.
 /// </param>
 /// <param name="val">
 /// The fragment offset.
 /// </param>
 public static void WINDIVERT_IPHDR_SET_FRAGOFF(WINDIVERT_IPHDR header, ushort val)
 {
     header.FragOff0 = (ushort)((header.FragOff0 & 0x00E0) | (val & 0xFF1F));
 }
示例#6
0
 /// <summary>
 /// Gets whether or not given ipv4 header has the reserved flag set.
 /// </summary>
 /// <param name="hdr">
 /// The ipv4 header.
 /// </param>
 /// <returns>
 /// True if the given ipv4 has the reserved flag set, false otherwise.
 /// </returns>
 public static bool WINDIVERT_IPHDR_GET_RESERVED(WINDIVERT_IPHDR hdr)
 {
     return((ushort)(hdr.FragOff0 & 0x0080) != 0);
 }