diff --git a/src/dotnet/design/Mil/Navy/Nrl/Norm/NormApi.puml b/src/dotnet/design/Mil/Navy/Nrl/Norm/NormApi.puml index c8a210c..c23811a 100644 --- a/src/dotnet/design/Mil/Navy/Nrl/Norm/NormApi.puml +++ b/src/dotnet/design/Mil/Navy/Nrl/Norm/NormApi.puml @@ -59,7 +59,8 @@ class NormApi + {static} NormSetGroupSize(sessionHandle:long, groupSize:long) : void + {static} NormSetTxRobustFactor(sessionHandle:long, robustFactor:int) : void + {static} NormFileEnqueue(sessionHandle:long, fileName:string, infoPtr:string, infoLen:int): long - + {static} NormDataEnqueue(sessionHandle:long, dataPtr:byte[], dataLen:int, infoPtr:byte[], infoLen:int) : long + + {static} NormDataEnqueue(sessionHandle:long, dataPtr:nint, dataLen:int, infoPtr:nint, infoLen:int) : long + + {static} NormDataEnqueue(sessionHandle:long, data:byte[], dataLen:int, info:byte[], infoLen:int) : long + {static} NormRequeueObject(sessionHandle:long, objectHandle:long) : bool + {static} NormStreamOpen(sessionHandle:long, bufferSize:long, infoPtr:string, infoLen:int) : long + {static} NormStreamClose(streamHandle:long, graceful:bool) : void diff --git a/src/dotnet/src/Mil.Navy.Nrl.Norm/NormApi.cs b/src/dotnet/src/Mil.Navy.Nrl.Norm/NormApi.cs index e8bc6db..5e969e9 100644 --- a/src/dotnet/src/Mil.Navy.Nrl.Norm/NormApi.cs +++ b/src/dotnet/src/Mil.Navy.Nrl.Norm/NormApi.cs @@ -542,7 +542,42 @@ namespace Mil.Navy.Nrl.Norm /// NORM_INFO content is left to the application's discretion /// A NormObjectHandle is returned which the application may use in other NORM API calls as needed. [DllImport(NORM_LIBRARY)] - public static extern long NormDataEnqueue(long sessionHandle, byte[] dataPtr, int dataLen, byte[]? infoPtr, int infoLen); + public static extern long NormDataEnqueue(long sessionHandle, nint dataPtr, int dataLen, nint infoPtr, int infoLen); + + /// + /// This function enqueues a segment of application memory space for transmission within the specified NORM sessionHandle. + /// + /// Used to identify application in the NormSession. + /// The data parameter must be a managed buffer to be transmitted. + /// The dataLen parameter indicates the quantity of data to transmit. + /// The optional info and infoLen parameters + /// are used to associate NORM_INFO content with the sent transport object. The maximum allowed infoLen + /// corresponds to the segmentSize used in the prior call to NormStartSender(). The use and interpretation of the + /// NORM_INFO content is left to the application's discretion. + /// The optional info and infoLen parameters + /// are used to associate NORM_INFO content with the sent transport object. The maximum allowed infoLen + /// corresponds to the segmentSize used in the prior call to NormStartSender(). The use and interpretation of the + /// NORM_INFO content is left to the application's discretion + /// A NormObjectHandle is returned which the application may use in other NORM API calls as needed. + public static long NormDataEnqueue(long sessionHandle, byte[] data, int dataLen, byte[]? info, int infoLen) + { + long objectHandle; + var dataHandle = GCHandle.Alloc(data, GCHandleType.Pinned); + var infoHandle = GCHandle.Alloc(info, GCHandleType.Pinned); + + try + { + var dataPtr = dataHandle.AddrOfPinnedObject(); + var infoPtr = infoHandle.AddrOfPinnedObject(); + objectHandle = NormDataEnqueue(sessionHandle, dataPtr, dataLen, infoPtr, infoLen); + } + finally + { + dataHandle.Free(); + infoHandle.Free(); + } + return objectHandle; + } /// /// This function allows the application to resend (or reset transmission of) a NORM_OBJECT_FILE or NORM_OBJECT_DATA