Class NetConvert
Inheritance
Inherited Members
Namespace: SIPSorcery.Sys
Assembly: SIPSorcery.dll
Syntax
public class NetConvert
Methods
| Improve this Doc View SourceDoReverseEndian(Int32)
Declaration
public static int DoReverseEndian(int x)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x |
Returns
Type | Description |
---|---|
System.Int32 |
DoReverseEndian(UInt16)
Declaration
public static ushort DoReverseEndian(ushort x)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | x |
Returns
Type | Description |
---|---|
System.UInt16 |
DoReverseEndian(UInt32)
Declaration
public static uint DoReverseEndian(uint x)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | x |
Returns
Type | Description |
---|---|
System.UInt32 |
DoReverseEndian(UInt64)
Declaration
public static ulong DoReverseEndian(ulong x)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | x |
Returns
Type | Description |
---|---|
System.UInt64 |
EndianFlip(UInt32)
Reverses the endianness of a UInt32.
Declaration
public static uint EndianFlip(uint val)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | val | The value to flip. |
Returns
Type | Description |
---|---|
System.UInt32 | The same value but with the endianness flipped. |
GetBytes(UInt16)
Get a buffer representing the unsigned 16 bit integer in network byte (big endian) order.
Declaration
public static byte[] GetBytes(ushort val)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | val | The value to convert. |
Returns
Type | Description |
---|---|
System.Byte[] | A buffer representing the value in network order |
GetBytes(UInt32)
Get a buffer representing the 32 bit unsigned integer in network byte (big endian) order.
Declaration
public static byte[] GetBytes(uint val)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | val | The value to convert. |
Returns
Type | Description |
---|---|
System.Byte[] | A buffer representing the value in network order |
GetBytes(UInt64)
Get a buffer representing the 64 bit unsigned integer in network byte (big endian) order.
Declaration
public static byte[] GetBytes(ulong val)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | val | The value to convert. |
Returns
Type | Description |
---|---|
System.Byte[] | A buffer representing the value in network order |
ParseUInt16(Byte[], Int32)
Parse a UInt16 from a network buffer using network byte order.
Declaration
public static ushort ParseUInt16(byte[] buffer, int posn)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer to parse the value from. |
System.Int32 | posn | The position in the buffer to start the parse from. |
Returns
Type | Description |
---|---|
System.UInt16 | A UInt16 value. |
ParseUInt32(Byte[], Int32)
Parse a UInt32 from a network buffer using network byte order.
Declaration
public static uint ParseUInt32(byte[] buffer, int posn)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer to parse the value from. |
System.Int32 | posn | The position in the buffer to start the parse from. |
Returns
Type | Description |
---|---|
System.UInt32 | A UInt32 value. |
ParseUInt64(Byte[], Int32)
Parse a UInt64 from a network buffer using network byte order.
Declaration
public static ulong ParseUInt64(byte[] buffer, int posn)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer to parse the value from. |
System.Int32 | posn | The position in the buffer to start the parse from. |
Returns
Type | Description |
---|---|
System.UInt64 | A UInt64 value. |
ToBuffer(UInt16, Byte[], Int32)
Writes a UInt16 value to a network buffer using network byte order.
Declaration
public static void ToBuffer(ushort val, byte[] buffer, int posn)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | val | The value to write to the buffer. |
System.Byte[] | buffer | The buffer to write the value to. |
System.Int32 | posn | The start position in the buffer to write the value at. |
ToBuffer(UInt32, Byte[], Int32)
Writes a UInt32 value to a network buffer using network byte order.
Declaration
public static void ToBuffer(uint val, byte[] buffer, int posn)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | val | The value to write to the buffer. |
System.Byte[] | buffer | The buffer to write the value to. |
System.Int32 | posn | The start position in the buffer to write the value at. |
ToBuffer(UInt64, Byte[], Int32)
Writes a UInt64 value to a network buffer using network byte order.
Declaration
public static void ToBuffer(ulong val, byte[] buffer, int posn)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | val | The value to write to the buffer. |
System.Byte[] | buffer | The buffer to write the value to. |
System.Int32 | posn | The start position in the buffer to write the value at. |