diff --git a/VERSION.TXT b/VERSION.TXT index 783a16d..091958b 100644 --- a/VERSION.TXT +++ b/VERSION.TXT @@ -1,5 +1,20 @@ NORM Version History +Version 1.5r5 +============= + - Added NORM_REMOTE_SENDER_RESET event to notify app when the sender + has been reset due to instance id, etc change + - Fixed possibly critical issue in Protolib ProtoDispatcher where + threaded dispatcher use (as the NORM API uses) could possibly result + in timers not being serviced properly. Most likely the issue could + only occur under certain, heavier NORM API usage patterns. Nonetheless, + this is an important fix. (Thanks to Michael Savisko of Arris). + - Fixed FreeBSD build (Thanks to Hans Duedal) + - Changed from 'b' (build) numbering schema to 'r' (release) to reduce + confusion with respect to "beta" versus "stable" releases. + - Note there are some "in-progress" API extensions in this release that + are not yet described in the developer's guide documentation. + Version 1.5b4 ============= - Corrected change in behavior of non-blocking version of @@ -24,7 +39,7 @@ Version 1.5b2 notification check acking status). Acknowledged, graceful shutdown streams, are automatically closed. - Fixed issue with compilation for NormObjectSize constructor, MSB(), and LSB() - methods on 32-bit systems. Thanks to Bill Skiba. + methods on 32-bit systems. (Thanks to Bill Skiba). Version 1.5b1 ============= diff --git a/doc/NormDeveloperGuide.html b/doc/NormDeveloperGuide.html index 06058b7..dbe0d43 100644 --- a/doc/NormDeveloperGuide.html +++ b/doc/NormDeveloperGuide.html @@ -1,6 +1,6 @@
-Abstract
This document describes an application programming interface (API) for the Nack-Oriented Reliable Multicast (NORM) protocol implementation developed by the Protocol Engineering and Advance Networking (PROTEAN) Research Group of the United States Naval Research Laboratory (NRL). The NORM protocol provides general purpose reliable data transport for applications wishing to use Internet Protocol (IP) Multicast services for group data delivery. NORM can also support unicast (point-to-point) data communication and may be used for such when deemed appropriate. The current NORM protocol specification is given in the Internet Engineering Task Force (IETF) RFC 3940. This document is currently a reference guide to the NORM API of the NRL reference implementation. More tutorial material may be include in a future version of this document or a separate developer's tutorial may be created at a later date.
This document describes an application programming interface (API) for the Nack-Oriented Reliable Multicast (NORM) protocol implementation developed by the Protocol Engineering and Advance Networking (PROTEAN) Research Group of the United States Naval Research Laboratory (NRL). The NORM protocol provides general purpose reliable data transport for applications wishing to use Internet Protocol (IP) Multicast services for group data delivery. NORM can also support unicast (point-to-point) data communication and may be used for such when deemed appropriate. The current NORM protocol specification is given in the Internet Engineering Task Force (IETF) RFC 5740.
The NORM protocol is designed to provide end-to-end reliable transport of bulk data objects or streams over generic IP multicast routing and forwarding services. NORM uses a selective, negative acknowledgement (NACK) mechanism for transport reliability and offers additional protocol mechanisms to conduct reliable multicast sessions with limited "a priori" coordination among senders and receivers. A congestion control scheme is specified to allow the NORM protocol to fairly share available network bandwidth with other transport protocols such as Transmission Control Protocol (TCP). It is capable of operating with both reciprocal multicast routing among senders and receivers and with asymmetric connectivity (possibly a unicast return path) from the senders to receivers. The protocol offers a number of features to allow different types of applications or possibly other higher-level transport protocols to utilize its service in different ways. The protocol leverages the use of FEC-based repair and other proven reliable multicast transport techniques in its design.
The NRL NORM library attempts to provide a general useful capability for development of reliable multicast applications for bulk file or other data delivery as well as support of stream-based transport with possible real-time delivery requirements. The API allows access to many NORM protocol parameters and control functions to tailor performance for specific applications. While default parameters, where provided, can be useful to a potential wide range of requirements, the many different possible group communication paradigms dictate different needs for different applications. Even with NORM, the developer should have a thorough understanding of the specific application's group communication needs.
The NORM API has been designed to provide simple, straightforward access to and control of NORM protocol state and functions. Functions are provided to create and initialize instances of the NORM API and associated transport sessions (NormSessions). Subsequently, NORM data transmission (NormSender) operation can be activated and the application can queue various types of data (NormObjects) for reliable transport. Additionally or alternatively, NORM reception (NormReceiver) operation can also be enabled on a per-session basis and the protocol implementation alerts the application of receive events.
By default, the NORM API will create an operating system thread in which the NORM protocol engine runs. This allows user application code and the underlying NORM code to execute somewhat independently of one another. The NORM protocol thread notifies the application of various protocol events through a thread-safe event dispatching mechanism and API calls are provided to allow the application to control NORM operation. (Note: API mechanisms for lower-level, non-threaded control and execution of the NORM protocol engine code may also be provided in the future.)
The NORM API operation can be roughly summarized with the following categories of functions:
API Initialization
Session Creation and Control
Data Transport
API Event Notification
Note the order of these categories roughly reflects the order of function calls required to use NORM in an application. The first step is to create and initialize, as needed, at least one instance of the NORM API. Then one or more NORM transport sessions (where a "session" corresponds to data exchanges on a given multicast group (or unicast address) and host port number) may be created and controlled. Applications may participate as senders and/or receivers within a NORM session. NORM senders transmit data to the session destination address (usually an IP multicast group) while receivers are notified of incoming data. The NORM API provides and event notification scheme to notify the application of significant sender and receiver events. There are also a number support functions provided for the application to control and monitor its participation within a NORM transport session.
The NORM API requires that an application explicitly create at least one instance of the NORM protocol engine that is subsequently used as a conduit for further NORM API calls. By default, the NORM protocol engine runs in its own operating system thread and interacts with the application in a thread-safe manner through the API calls and event dispatching mechanism.
In general, only a single thread should access the NormGetNextEvent() API call for a given NormInstance. This function serves as the conduit for delivering NORM protocol engine events to the application. A NORM application can be designed to be single-threaded, even with multiple active NormSessions, but also multiple API instances can be created (see NormCreateInstance()) as needed for applications with specific requirements for accessing and controlling participation in multiple NormSessions from separate operating system multiple threads. Or, alternatively, a single NormInstance could be used, with a "master thread" serving as an intermediary between the NormGetNextEvent() function, demultiplexing and dispatching events as appropriate to other "child threads" that are created to handle "per-NormSession" input/output. The advantage of this alternative approach is that the end result would be one NORM protocol engine thread plus one "master thread" plus one "child thread" per NormSession instead of two threads (protocol engine plus application thread) per NormSession if such multi-threaded operation is needed by the application.
Once an API instance has been successfully created, the application may then create NORM transport session instances as needed. The application can participate in each session as a sender and/or receiver of data. If an application is participating as a sender, it may enqueue data transport objects for transmission. The control of transmission is largely left to the senders and API calls are provided to control transmission rate, FEC parameters, etc. Applications participating as receivers will be notified via the NORM API's event dispatching mechanism of pending and completed reliable reception of data along with other significant events. Additionally, API controls for some optional NORM protocol mechanisms, such as positive acknowledgment collection, are also provided.
Note when multiple senders are involved, receivers allocate system resources (buffer space) for each active sender. With a very large number of concurrently active senders, this may translate to significant memory allocation on receiver nodes. Currently, the API allows the application to control how much buffer space is allocated for each active sender (NOTE: In the future, API functions may be provided limit the number of active senders monitored and/or provide the application with finer control over receive buffer allocation, perhaps on a per sender basis).
The NORM protocol supports transport of three basic types of data content. These include the types NORM_OBJECT_FILE and NORM_OBJECT_DATA which represent predetermined, fixed-size application data content. The only differentiation with respect to these two types is the implicit "hint" to the receiver to use non-volatile (i.e. file system) storage or memory. This "hint" lets the receiver allocate appropriate storage space with no other information on the incoming data. The NORM implementation reads/writes data for the NORM_OBJECT_FILE type directly from/to file storage, while application memory space is accessed for the NORM_OBJECT_DATA type. The third data content type, NORM_OBJECT_STREAM, represents unbounded, possibly persistent, streams of data content. Using this transport paradigm, traditional, byte-oriented streaming transport service (e.g. similar to that provided by a TCP socket) can be provided. Additionally, NORM has provisions for application-defined message-oriented transport where receivers can recover message boundaries without any "handshake" with the sender. Stream content is buffered by the NORM implementation for transmission/retransmission and as it is received.
The behavior of data transport operation is largely placed in the control of the NORM sender(s). NORM senders controls their data transmission rate, forward error correction (FEC) encoding settings, and parameters controlling feedback from the receiver group. Multiple senders may operate in a session, each with independent transmission parameters. NORM receivers learn needed parameter values from fields in NORM message headers.
NORM transport "objects" (file, data, or stream) are queued for transmission by NORM senders. NORM senders may also cancel transmission of objects at any time. The NORM sender controls the transmission rate either manually (fixed transmission rate) or automatically when NORM congestion control operation is enabled. The NORM congestion control mechanism is designed to be "friendly" to other data flows on the network, fairly sharing available bandwidth.NormSetAutoParity()) to achieve reliable transfer) receive object transmission before any extensive repair process that may be required to satisfy other receivers with poor network connectivity. The repair boundary can also be set for individual remote senders using the NormNodeSetRepairBoundary() function.NORM_OBJECT_FILE objects. This function must be called before any file objects may be received and thus should be called before any calls to NormStartReceiver() are made. However, note that the cache directory may be changed even during active NORM reception. In this case, the new specified directory path will be used for subsequently-received files. Any files received before a directory path change will remain in the previous cache location. Note that the NormFileRename() function may be used to rename, and thus potentially move, received files after reception has begun.
By default, the NORM sender transmits application-enqueued data content, providing repair transmissions (usually in the form of FEC messages) only when requested by NACKs from the receivers. However, the application may also configure NORM to proactively send some amount of FEC content along with the original data content to create a "robust" transmission that, in some cases, may be reliably received without any NACKing activity. This can allow for some degree of reliable protocol operation even without receiver feedback available. NORM senders may also requeue (within the limits of "transmit cache" settings) objects for repeat transmission, and receivers may combine together multiple transmissions to reliably receive content. Additionally, hybrid proactive/reactive FEC repair operation is possible with the receiver NACK process as a "backup" for when network packet loss exceeds the repair capability of the proactive FEC settings.
The NRL NORM implementation also supports optional collection of positive acknowledgment from a subset of the receiver group at application-determined positions during data transmission. The NORM API allows the application to specify the receiver subset ("acking node list") and set "watermark" points for which positive acknowledgement is collected. This process can provide the application with explicit flow control for an application-determined critical set of receivers in the group.
For a NORM application to perform data transmission, it must first create a session using NormCreateSession() and make a call to NormStartSender() before sending actual user data. The functions NormFileEnqueue(), NormDataEnqueue(), and NormStreamWrite() are available for the application to pass data to the NORM protocol engine for transmission. Note that to use NormStreamWrite(), a "sender stream" must first be created using NormStreamOpen(). In the case of NormFileEnqueue() and NormDataEnqueue(), the NORM protocol engine directly accesses the application file or memory space to refer to the transmitted content and does not make its own copy of this data.
The calls to enqueue transport objects or write to a stream may be called at any time, but the NORM_TX_QUEUE_EMPTY and NORM_TX_QUEUE_VACANCY notification events (see NormGetNextEvent()) provide useful cues for when these functions may be successfully called. Typically, an application might catch both NORM_TX_QUEUE_EMPTY and NORM_TX_QUEUE_VACANCY event types as cues for enqueuing additional transport objects or writing to a stream. However, an application may choose to cue off of NORM_TX_QUEUE_EMPTY only if it wishes to provide the "freshest" data to NORM for transmission. The advantage of additionally using NORM_TX_QUEUE_VACANCY is that if the application uses this cue to fill up NORM transport object or stream buffers, it can keep the NORM stream busy sending data and realize the highest possible transmission rate when attempting very high speed communication (Otherwise, the NORM protocol engine may experience some "dead air time" waiting for the application thread to respond to a NORM_TX_QUEUE_EMPTY event). Note the sender application can control buffer depths as needed with the NormSetTxCacheBounds() and NormStreamOpen() calls. Additionally, it is possible for applications to configure the transmit object "cache" (see NormSetTxCacheBounds()) and use the NormRequeueObject() call (for objects that have not yet received a NORM_TX_OBJECT_PURGED notification) to effect a sort of "data carousel" operation with repeated transmission of the cached objects. The NORM_TX_OBJECT_SENT notification can be used a cue to properly control the "requeue" cycle(s).
The NORM implementation provides a form of timer-based flow control that limits how quickly sender applications may enqueue new objects or stream data for transmission. The NormSetFlowControl() call is provided to control this behavior, including the option to disable it. This timer-based mechanism is a type of "soft" flow control by allowing receivers "sufficient" time to request repair of pending data the sender has enqueued. A more explicit form of flow control using the optional "watermark flushing" mechanism is described below.
Another cue that can be leveraged by the sender application to determine when it is appropriate to enqueue (or write) additional data for transmission is the NORM_TX_WATERMARK_COMPLETED event. This event is posted when the flushing or explicit positive acknowledgment collection process has completed for a "watermark" point in transmission that was set by the sender (see NormSetWatermark() and NormAddAckingNode()). A list of NormNodeId values can be supplied from which explicit acknowledgement is expected and/or the NormNodeId NORM_NODE_NONE can be set (using NormAddAckingNode()) for completion of a NACK-based version of the watermark flushing procedure. This flushing process can be used as a flow control mechanism for NORM applications. Note this is distinct from NORM's congestion control mechanism that, while it provides network-friendly transmission rate control, does guarantee flow control to receiving nodes.NORM_NODE_NONE can be set (using NormAddAckingNode()) for completion of a NACK-based version of the watermark flushing procedure. This flushing process can be used as a flow control mechanism for NORM applications. Note this is distinct from NORM's congestion control mechanism that, while it provides network-friendly transmission rate control, does guarantee flow control to receiving nodes.
NORM receiver applications learn of active senders and their corresponding pending and completed data transfers, etc via the API event dispatching mechanism. By default, NORM receivers use NACK messages to request repair of transmitted content from the originating sender as needed to achieve reliable transfer. Some API functions are available to provide some additional control over the NACKing behavior, such as initially NACKing for NORM_INFO content only or even to the extent of disabling receiver feedback (silent receiver or emission-controlled (EMCON) operation) entirely. Otherwise, the parameters and operation of reliable data transmission are left to sender applications and receivers learn of sender parameters in NORM protocol message headers and are instructed by NORM_CMD messages from the sender(s).
With respect to the NORM API, the receiver application is informed of new senders and receive data objects via the the NORM_REMOTE_SENDER_NEW and NORM_RX_OBJECT_NEW notifications, respectfully. Additionally, object reception progress is indicated with the NORM_RX_OBJECT_UPDATED notification and this also serves as an indicator for the NORM_OBJECT_STREAM type that the receive application should make calls to NormStreamRead() to read newly received stream content. NORM sender status is also conveyed via the NORM_REMOTE_SENDER_ACTIVE and NORM_REMOTE_SENDER_INACTIVE notifications. For example, the receiver application may use the NORM_REMOTE_SENDER_INACTIVE as a cue to make calls to NormNodeFreeBuffers() and/or NormNodeDelete() to free memory resources allocated for buffering received content for the given sender. The amount of memory allocated per sender is set in the NormStartReceiver() call.
An asynchronous event dispatching mechanism is provided to notify the application of significant NORM protocol events. The centerpiece of this is the NormGetNextEvent() function that can be used to retrieve the next NORM protocol engine event in the form of a NormEvent structure. This function will typically block until a NormEvent occurs. However, non-blocking operation may be achieved by using the NormGetDescriptor() call to get a NormDescriptor (file descriptor) value (Unix int or Win32 HANDLE) suitable for use in a asynchronous I/O monitoring functions such as the Unix select() or Win32 MsgWaitForMultipleObjects() system calls. The a NormDescriptor will be signaled when a NormEvent is available. For Win32 platforms, dispatching of a user-defined Windows message for NORM event notification is also planned for a future update to the NORM API.
To build applications that use the NORM library, a path to the "normApi.h" header file must be provided and the linker step needs to reference the NORM library file ("libnorm.a" for Unix platforms and "Norm.lib" for Win32 platforms). NORM also depends upon the NRL Protean Protocol Prototyping toolkit "Protokit" library (a.k.a "Protolib") (static library files "libProtokit.a" for Unix and "Protokit.lib" for Win32). Shared or dynamically-linked versions of these libraries may also be built from the NORM source code or provided. Depending upon the platform, some additional library dependencies may be required to support the needs of NORM and/or Protokit. These are described below.
The "makefiles" directory contains Unix Makefiles for various platforms the "win32" and "wince" sub-directories there contain Microsoft Visual C++ (VC++) and Embedded VC++ project files for building the NORM implementation. Additionally, a "waf" (Python-based build tool) build option is supported that can be used to build and install the NORM library code on the supported platforms. Finally, Python and Java bindings to the NORM API are included and "src/python" and "src/java" directories contain the code for these and the "makefiles/java" directory contains Makefiles to build the NORM Java JNI bindings. Note the "waf" tool can also be used to build the Java and Python bindings.
NORM has been built and tested on Linux (various architectures), MacOS (BSD), Solaris, and IRIX (SGI) platforms. The code should be readily portable to other Unix platforms.
To support IPv6 operation, the NORM and the Protokit library must be compiled with the "HAVE_IPV6" macro defined. This is default in the NORM and Protokit Makefiles for platforms that support IPv6. It is important that NORM and Protokit be built with this macro defined the same. With NORM, it is recommended that "large file support" options be enabled when possible.
The NORM API uses threading so that the NORM protocol engine may run independent of the application. Thus the "POSIX Threads" library must be included ("-pthread") in the linking step. MacOS/BSD also requires the addition of the "-lresolv" (resolver) library and Solaris requires the dynamic loader, network/socket, and resolver libraries ("-lnsl -lsocket -lresolv") to achieve successful compilation. The Makefiles in the NORM source code distribution are a reference for these requirements. Note that MacOS 9 and earlier are not supported.
Additionally, it is critical that the _FILE_OFFSET_BITS macro be consistently defined for the NORM library build and the application build using the library. The distributed NORM Makefiles have -D_FILE_OFFSET_BITS=64 set in the compilation to enable "large file support". Applications built using NORM should have the same compilation option set to operate correctly (The definition of the NormSize type in "normApi.h" depends upon this compilation flag).
NORM has been built using Microsoft's Visual C++ (6.0 and .NET) and Embedded VC++ 4.2 environments. In addition to proper macro definitions (e.g., HAVE_IPV6, etc) that are included in the respective "Protokit" and "NORM" project files, it is important that common code generation settings be used when building the NORM application. The NORM and Protokit projects are built with the "Multi-threading DLL" library usage set. The NORM API requires multi-threading support. This is a critical setting and numerous compiler and linker errors will result if this is not properly set for your application project.
NORM and Protokit also depend on the Winsock 2.0 ("ws2_32.lib" (or "ws2.lib" (WinCE)) and the IP Helper API ("iphlpapi.lib") libraries and these must be included in the project "Link" attributes.
An additional note is that a bug in VC++ 6.0 and earlier compilers (includes embedded VC++ 4.x compilers) prevent compilation of Protokit-based code with debugging capabilities enabled. However, this has been resolved in VC++ .NET and is hoped to be resolved in the future for the WinCE build tools.
Operation on Windows NT4 (and perhaps other older Windows operating systems) requires that the compile time macro WINVER=0x0400 defined. This is because the version of the IP Helper API library (iphlpapi.lib) used by Protolib (and hence NORM) for this system doesn't support some of the functions defined for this library. This may be related to IPv6 support issues so it may be possible that the Protolib build could be tweaked to provide a single binary executable suitable for IPv4 operation only across a large range of Windows platforms.
This section provides a reference to the NORM API variable types, constants and functions.
The NORM API defines and enumerates a number of supporting variable types and values which are used in different function calls. The variable types are described here.
The NormInstanceHandle type is returned when a NORM API instance is created (see NormCreateInstance()). This handle can be subsequently used for API calls which require reference to a specific NORM API instance. By default, each NORM API instance instantiated creates an operating system thread for protocol operation. Note that multiple NORM transport sessions may be created for a single API instance. In general, it is expected that applications will create a single NORM API instance, but some multi-threaded application designs may prefer multiple corresponding NORM API instances. The value NORM_INSTANCE_INVALID corresponds to an invalid API instance.
The NormSessionHandle type is used to reference NORM transport sessions which have been created using the NormCreateSession() API call. Multiple NormSessionHandle values may be associated with a given NormInstanceHandle. The special value NORM_SESSION_INVALID is used to refer to invalid session references.
The NormSessionId type is used by applications to uniquely identify their instance of participation as a sender within a NormSession. This type is a parameter to the NormStartSender() function. Robust applications can use different NormSessionId values when initiating sender operation so that receivers can discriminate when a sender has terminated and restarted (whether intentional or due to system failure). For example, an application could cache its prior NormSessionId value in non-volatile storage which could then be recovered and incremented (for example) upon system restart to produce a new value. The NormSessionId value is used for the value of the instance_id field in NORM protocol sender messages (see the NORM protocol specification) and receivers use this field to detect sender restart within a NormSession.
The NormNodeHandle type is used to reference state kept by the NORM implementation with respect to other participants within a NormSession. Most typically, the NormNodeHandle is used by receiver applications to dereference information about remote senders of data as needed. The special value NORM_NODE_INVALID corresponds to an invalid reference.
The NormNodeId type corresponds to a 32-bit numeric value which should uniquely identify a participant (node) in a given NormSession. The NormNodeGetId() function can be used to retrieve this value given a valid NormNodeHandle. The special value NORM_NODE_NONE corresponds to an invalid (or null) node while the value NORM_NODE_ANY serves as a wild card value for some functions.
The NormObjectHandle type is used to reference state kept for data transport objects being actively transmitted or received. The state kept for NORM transport objects is temporary, but the NORM API provides a function to persistently retain state associated with a sender or receiver NormObjectHandle (see NormObjectRetain()) if needed. For sender objects, unless explicitly retained, the NormObjectHandle can be considered valid until the referenced object is explicitly canceled (see NormObjectCancel()) or purged from the sender transmission queue (see the event NORM_TX_OBJECT_PURGED). For receiver objects, these handles should be treated as valid only until a subsequent call to NormGetNextEvent() unless, again, specifically retained. The special value NORM_OBJECT_INVALID corresponds to an invalid transport object reference.
The NormObjectType type is an enumeration of possible NORM data transport object types. As previously mentioned, valid types include:
NORM_OBJECT_FILE
NORM_OBJECT_DATA, and
NORM_OBJECT_STREAM
Given a NormObjectHandle, the application may determine an object's type using the NormObjectGetType() function call. A special NormObjectType value, NORM_OBJECT_NONE, indicates an invalid object type.
The NormSize is the type used for NormObject size information. For example, the NormObjectGetSize() function returns a value of type NormSize. The range of NormSize values depends upon the operating system and NORM library compilation settings. With "large file support" enabled, as is the case with distributed NORM library "Makefiles", the NormSize type is a 64-bit integer. However, some platforms may support only 32-bit object sizes.
The NormObjectTransportId type is a 16-bit numerical value assigned to NormObjects by senders during active transport. These values are temporarily unique with respect to a given sender within a NormSession and may be "recycled" for use for future transport objects. NORM sender nodes assign these values in a monotonically increasing fashion during the course of a session as part of protocol operation. Typically, the application should not need access to these values, but an API call such as NormObjectGetTransportId() (TBD) may be provided to retrieve these values if needed. (Note this type may be deprecated; i.e., it may not be needed at since the NormRequeueObject() function is implemented using handles only, but _some_ applications requiring persistence even after a system reboot may need the ability to recall previous transport ids?)
The NormEventType is an enumeration of NORM API events. "Events" are used by the NORM API to signal the application of significant NORM protocol operation events (e.g., receipt of a new receive object, etc). A description of possible NormEventType values and their interpretation is given below. The function call NormGetNextEvent() is used to retrieve events from the NORM protocol engine.
The NormEvent type is a structure used to describe significant NORM protocol events. This structure is defined as follows:
typedef struct +NORM Developer's Guide (version 1.5b5) Abstract
This document describes an application programming interface (API) for the Nack-Oriented Reliable Multicast (NORM) protocol implementation developed by the Protocol Engineering and Advance Networking (PROTEAN) Research Group of the United States Naval Research Laboratory (NRL). The NORM protocol provides general purpose reliable data transport for applications wishing to use Internet Protocol (IP) Multicast services for group data delivery. NORM can also support unicast (point-to-point) data communication and may be used for such when deemed appropriate. The current NORM protocol specification is given in the Internet Engineering Task Force (IETF) RFC 3940. This document is currently a reference guide to the NORM API of the NRL reference implementation. More tutorial material may be include in a future version of this document or a separate developer's tutorial may be created at a later date.
Table of Contents
- 1. Background
- 2. Overview
- 3. Build Notes
- 4. API Reference
- 4.1. API Variable Types and Constants
- 4.1.1. NormInstanceHandle
- 4.1.2. NormSessionHandle
- 4.1.3. NormSessionId
- 4.1.4. NormNodeHandle
- 4.1.5. NormNodeId
- 4.1.6. NormObjectHandle
- 4.1.7. NormObjectType
- 4.1.8. NormSize
- 4.1.9. NormObjectTransportId
- 4.1.10. NormEventType
- 4.1.11. NormEvent
- 4.1.12. NormDescriptor
- 4.1.13. NormFlushMode
- 4.1.14. NormProbingMode
- 4.1.15. NormSyncPolicy
- 4.1.16. NormNackingMode
- 4.1.17. NormRepairBoundary
- 4.1.18. NormAckingStatus
- 4.2. API Initialization and Operation
- 4.3. Session Creation and Control Functions
- 4.3.1. NormCreateSession()
- 4.3.2. NormDestroySession()
- 4.3.3. NormSetUserData()
- 4.3.4. NormGetUserData()
- 4.3.5. NormGetLocalNodeId()
- 4.3.6. NormSetTxPort()
- 4.3.7. NormSetTxOnly()
- 4.3.8. NormSetRxPortReuse()
- 4.3.9. NormSetMulticastInterface()
- 4.3.10. NormSetSSM()
- 4.3.11. NormSetTTL()
- 4.3.12. NormSetTOS()
- 4.3.13. NormSetLoopback()
- 4.3.14. NormSetFragmentation()
- 4.4. NORM Sender Functions
- 4.4.1. NormStartSender()
- 4.4.2. NormStopSender()
- 4.4.3. NormSetTxRate()
- 4.4.4. NormGetTxRate()
- 4.4.5. NormSetTxSocketBuffer()
- 4.4.6. NormSetFlowControl()
- 4.4.7. NormSetCongestionControl()
- 4.4.8. NormSetTxRateBounds()
- 4.4.9. NormSetTxCacheBounds()
- 4.4.10. NormSetAutoParity()
- 4.4.11. NormGetGrttEstimate()
- 4.4.12. NormSetGrttEstimate()
- 4.4.13. NormSetGrttMax()
- 4.4.14. NormSetGrttProbingMode()
- 4.4.15. NormSetGrttProbingInterval()
- 4.4.16. NormSetBackoffFactor()
- 4.4.17. NormSetGroupSize()
- 4.4.18. NormSetTxRobustFactor()
- 4.4.19. NormFileEnqueue()
- 4.4.20. NormDataEnqueue()
- 4.4.21. NormRequeueObject()
- 4.4.22. NormStreamOpen()
- 4.4.23. NormStreamClose()
- 4.4.24. NormStreamWrite()
- 4.4.25. NormStreamFlush()
- 4.4.26. NormStreamSetAutoFlush()
- 4.4.27. NormStreamSetPushEnable()
- 4.4.28. NormStreamHasVacancy()
- 4.4.29. NormStreamMarkEom()
- 4.4.30. NormSetWatermark()
- 4.4.31. NormCancelWatermark()
- 4.4.32. NormAddAckingNode()
- 4.4.33. NormRemoveAckingNode()
- 4.4.34. NormGetNextAckingNode()
- 4.4.35. NormGetAckingStatus()
- 4.4.36. NormSendCommand()
- 4.4.37. NormCancelCommand()
- 4.5. NORM Receiver Functions
- 4.5.1. NormStartReceiver()
- 4.5.2. NormStopReceiver()
- 4.5.3. NormSetRxCacheLimit()
- 4.5.4. NormSetRxSocketBuffer()
- 4.5.5. NormSetSilentReceiver()
- 4.5.6. NormSetDefaultUnicastNack()
- 4.5.7. NormNodeSetUnicastNack()
- 4.5.8. NormSetDefaultSyncPolicy()
- 4.5.9. NormSetDefaultNackingMode()
- 4.5.10. NormNodeSetNackingMode()
- 4.5.11. NormObjectSetNackingMode()
- 4.5.12. NormSetDefaultRepairBoundary()
- 4.5.13. NormNodeSetRepairBoundary()
- 4.5.14. NormSetDefaultRxRobustFactor()
- 4.5.15. NormNodeSetRxRobustFactor()
- 4.5.16. NormStreamRead()
- 4.5.17. NormStreamSeekMsgStart()
- 4.5.18. NormStreamGetReadOffset()
- 4.6. NORM Object Functions
- 4.6.1. NormObjectGetType()
- 4.6.2. NormObjectHasInfo()
- 4.6.3. NormObjectGetInfoLength()
- 4.6.4. NormObjectGetInfo()
- 4.6.5. NormObjectGetSize()
- 4.6.6. NormObjectGetBytesPending()
- 4.6.7. NormObjectCancel()
- 4.6.8. NormObjectRetain()
- 4.6.9. NormObjectRelease()
- 4.6.10. NormFileGetName()
- 4.6.11. NormFileRename()
- 4.6.12. NormDataAccessData()
- 4.6.13. NormDataDetachData()
- 4.6.14. NormObjectGetSender()
- 4.7. NORM Node Functions
- 4.8. NORM Debugging Functions
This document describes an application programming interface (API) for the Nack-Oriented Reliable Multicast (NORM) protocol implementation developed by the Protocol Engineering and Advance Networking (PROTEAN) Research Group of the United States Naval Research Laboratory (NRL). The NORM protocol provides general purpose reliable data transport for applications wishing to use Internet Protocol (IP) Multicast services for group data delivery. NORM can also support unicast (point-to-point) data communication and may be used for such when deemed appropriate. The current NORM protocol specification is given in the Internet Engineering Task Force (IETF) RFC 5740.
The NORM protocol is designed to provide end-to-end reliable transport of bulk data objects or streams over generic IP multicast routing and forwarding services. NORM uses a selective, negative acknowledgement (NACK) mechanism for transport reliability and offers additional protocol mechanisms to conduct reliable multicast sessions with limited "a priori" coordination among senders and receivers. A congestion control scheme is specified to allow the NORM protocol to fairly share available network bandwidth with other transport protocols such as Transmission Control Protocol (TCP). It is capable of operating with both reciprocal multicast routing among senders and receivers and with asymmetric connectivity (possibly a unicast return path) from the senders to receivers. The protocol offers a number of features to allow different types of applications or possibly other higher-level transport protocols to utilize its service in different ways. The protocol leverages the use of FEC-based repair and other proven reliable multicast transport techniques in its design.
The NRL NORM library attempts to provide a general useful capability for development of reliable multicast applications for bulk file or other data delivery as well as support of stream-based transport with possible real-time delivery requirements. The API allows access to many NORM protocol parameters and control functions to tailor performance for specific applications. While default parameters, where provided, can be useful to a potential wide range of requirements, the many different possible group communication paradigms dictate different needs for different applications. Even with NORM, the developer should have a thorough understanding of the specific application's group communication needs.
The NORM API has been designed to provide simple, straightforward access to and control of NORM protocol state and functions. Functions are provided to create and initialize instances of the NORM API and associated transport sessions (NormSessions). Subsequently, NORM data transmission (NormSender) operation can be activated and the application can queue various types of data (NormObjects) for reliable transport. Additionally or alternatively, NORM reception (NormReceiver) operation can also be enabled on a per-session basis and the protocol implementation alerts the application of receive events.
By default, the NORM API will create an operating system thread in which the NORM protocol engine runs. This allows user application code and the underlying NORM code to execute somewhat independently of one another. The NORM protocol thread notifies the application of various protocol events through a thread-safe event dispatching mechanism and API calls are provided to allow the application to control NORM operation. (Note: API mechanisms for lower-level, non-threaded control and execution of the NORM protocol engine code may also be provided in the future.)
The NORM API operation can be roughly summarized with the following categories of functions:
API Initialization
Session Creation and Control
Data Transport
API Event Notification
Note the order of these categories roughly reflects the order of function calls required to use NORM in an application. The first step is to create and initialize, as needed, at least one instance of the NORM API. Then one or more NORM transport sessions (where a "session" corresponds to data exchanges on a given multicast group (or unicast address) and host port number) may be created and controlled. Applications may participate as senders and/or receivers within a NORM session. NORM senders transmit data to the session destination address (usually an IP multicast group) while receivers are notified of incoming data. The NORM API provides and event notification scheme to notify the application of significant sender and receiver events. There are also a number support functions provided for the application to control and monitor its participation within a NORM transport session.
The NORM API requires that an application explicitly create at least one instance of the NORM protocol engine that is subsequently used as a conduit for further NORM API calls. By default, the NORM protocol engine runs in its own operating system thread and interacts with the application in a thread-safe manner through the API calls and event dispatching mechanism.
In general, only a single thread should access the
NormGetNextEvent()API call for a given NormInstance. This function serves as the conduit for delivering NORM protocol engine events to the application. A NORM application can be designed to be single-threaded, even with multiple active NormSessions, but also multiple API instances can be created (seeNormCreateInstance()) as needed for applications with specific requirements for accessing and controlling participation in multiple NormSessions from separate operating system multiple threads. Or, alternatively, a single NormInstance could be used, with a "master thread" serving as an intermediary between theNormGetNextEvent()function, demultiplexing and dispatching events as appropriate to other "child threads" that are created to handle "per-NormSession" input/output. The advantage of this alternative approach is that the end result would be one NORM protocol engine thread plus one "master thread" plus one "child thread" per NormSession instead of two threads (protocol engine plus application thread) per NormSession if such multi-threaded operation is needed by the application.Once an API instance has been successfully created, the application may then create NORM transport session instances as needed. The application can participate in each session as a sender and/or receiver of data. If an application is participating as a sender, it may enqueue data transport objects for transmission. The control of transmission is largely left to the senders and API calls are provided to control transmission rate, FEC parameters, etc. Applications participating as receivers will be notified via the NORM API's event dispatching mechanism of pending and completed reliable reception of data along with other significant events. Additionally, API controls for some optional NORM protocol mechanisms, such as positive acknowledgment collection, are also provided.
Note when multiple senders are involved, receivers allocate system resources (buffer space) for each active sender. With a very large number of concurrently active senders, this may translate to significant memory allocation on receiver nodes. Currently, the API allows the application to control how much buffer space is allocated for each active sender (NOTE: In the future, API functions may be provided limit the number of active senders monitored and/or provide the application with finer control over receive buffer allocation, perhaps on a per sender basis).
The NORM protocol supports transport of three basic types of data content. These include the types
NORM_OBJECT_FILEandNORM_OBJECT_DATAwhich represent predetermined, fixed-size application data content. The only differentiation with respect to these two types is the implicit "hint" to the receiver to use non-volatile (i.e. file system) storage or memory. This "hint" lets the receiver allocate appropriate storage space with no other information on the incoming data. The NORM implementation reads/writes data for theNORM_OBJECT_FILEtype directly from/to file storage, while application memory space is accessed for theNORM_OBJECT_DATAtype. The third data content type,NORM_OBJECT_STREAM, represents unbounded, possibly persistent, streams of data content. Using this transport paradigm, traditional, byte-oriented streaming transport service (e.g. similar to that provided by a TCP socket) can be provided. Additionally, NORM has provisions for application-defined message-oriented transport where receivers can recover message boundaries without any "handshake" with the sender. Stream content is buffered by the NORM implementation for transmission/retransmission and as it is received.The behavior of data transport operation is largely placed in the control of the NORM sender(s). NORM senders controls their data transmission rate, forward error correction (FEC) encoding settings, and parameters controlling feedback from the receiver group. Multiple senders may operate in a session, each with independent transmission parameters. NORM receivers learn needed parameter values from fields in NORM message headers.
NORM transport "objects" (file, data, or stream) are queued for transmission by NORM senders. NORM senders may also cancel transmission of objects at any time. The NORM sender controls the transmission rate either manually (fixed transmission rate) or automatically when NORM congestion control operation is enabled. The NORM congestion control mechanism is designed to be "friendly" to other data flows on the network, fairly sharing available bandwidth.
NormSetAutoParity()) to achieve reliable transfer) receive object transmission before any extensive repair process that may be required to satisfy other receivers with poor network connectivity. The repair boundary can also be set for individual remote senders using theNormNodeSetRepairBoundary()function.NORM_OBJECT_FILEobjects. This function must be called before any file objects may be received and thus should be called before any calls toNormStartReceiver()are made. However, note that the cache directory may be changed even during active NORM reception. In this case, the new specified directory path will be used for subsequently-received files. Any files received before a directory path change will remain in the previous cache location. Note that theNormFileRename()function may be used to rename, and thus potentially move, received files after reception has begun.By default, the NORM sender transmits application-enqueued data content, providing repair transmissions (usually in the form of FEC messages) only when requested by NACKs from the receivers. However, the application may also configure NORM to proactively send some amount of FEC content along with the original data content to create a "robust" transmission that, in some cases, may be reliably received without any NACKing activity. This can allow for some degree of reliable protocol operation even without receiver feedback available. NORM senders may also requeue (within the limits of "transmit cache" settings) objects for repeat transmission, and receivers may combine together multiple transmissions to reliably receive content. Additionally, hybrid proactive/reactive FEC repair operation is possible with the receiver NACK process as a "backup" for when network packet loss exceeds the repair capability of the proactive FEC settings.
The NRL NORM implementation also supports optional collection of positive acknowledgment from a subset of the receiver group at application-determined positions during data transmission. The NORM API allows the application to specify the receiver subset ("acking node list") and set "watermark" points for which positive acknowledgement is collected. This process can provide the application with explicit flow control for an application-determined critical set of receivers in the group.
For a NORM application to perform data transmission, it must first create a session using
NormCreateSession()and make a call toNormStartSender()before sending actual user data. The functionsNormFileEnqueue(),NormDataEnqueue(), andNormStreamWrite()are available for the application to pass data to the NORM protocol engine for transmission. Note that to useNormStreamWrite(), a "sender stream" must first be created usingNormStreamOpen(). In the case ofNormFileEnqueue()andNormDataEnqueue(), the NORM protocol engine directly accesses the application file or memory space to refer to the transmitted content and does not make its own copy of this data.The calls to enqueue transport objects or write to a stream may be called at any time, but the
NORM_TX_QUEUE_EMPTYandNORM_TX_QUEUE_VACANCYnotification events (seeNormGetNextEvent()) provide useful cues for when these functions may be successfully called. Typically, an application might catch bothNORM_TX_QUEUE_EMPTYandNORM_TX_QUEUE_VACANCYevent types as cues for enqueuing additional transport objects or writing to a stream. However, an application may choose to cue off ofNORM_TX_QUEUE_EMPTYonly if it wishes to provide the "freshest" data to NORM for transmission. The advantage of additionally usingNORM_TX_QUEUE_VACANCYis that if the application uses this cue to fill up NORM transport object or stream buffers, it can keep the NORM stream busy sending data and realize the highest possible transmission rate when attempting very high speed communication (Otherwise, the NORM protocol engine may experience some "dead air time" waiting for the application thread to respond to aNORM_TX_QUEUE_EMPTYevent). Note the sender application can control buffer depths as needed with theNormSetTxCacheBounds()andNormStreamOpen()calls. Additionally, it is possible for applications to configure the transmit object "cache" (seeNormSetTxCacheBounds()) and use theNormRequeueObject()call (for objects that have not yet received aNORM_TX_OBJECT_PURGEDnotification) to effect a sort of "data carousel" operation with repeated transmission of the cached objects. TheNORM_TX_OBJECT_SENTnotification can be used a cue to properly control the "requeue" cycle(s).The NORM implementation provides a form of timer-based flow control that limits how quickly sender applications may enqueue new objects or stream data for transmission. The
NormSetFlowControl()call is provided to control this behavior, including the option to disable it. This timer-based mechanism is a type of "soft" flow control by allowing receivers "sufficient" time to request repair of pending data the sender has enqueued. A more explicit form of flow control using the optional "watermark flushing" mechanism is described below.Another cue that can be leveraged by the sender application to determine when it is appropriate to enqueue (or write) additional data for transmission is the
NORM_TX_WATERMARK_COMPLETEDevent. This event is posted when the flushing or explicit positive acknowledgment collection process has completed for a "watermark" point in transmission that was set by the sender (seeNormSetWatermark()andNormAddAckingNode()). A list ofNormNodeIdvalues can be supplied from which explicit acknowledgement is expected and/or theNormNodeIdNORM_NODE_NONEcan be set (usingNormAddAckingNode()) for completion of a NACK-based version of the watermark flushing procedure. This flushing process can be used as a flow control mechanism for NORM applications. Note this is distinct from NORM's congestion control mechanism that, while it provides network-friendly transmission rate control, does guarantee flow control to receiving nodes.NORM_NODE_NONEcan be set (usingNormAddAckingNode()) for completion of a NACK-based version of the watermark flushing procedure. This flushing process can be used as a flow control mechanism for NORM applications. Note this is distinct from NORM's congestion control mechanism that, while it provides network-friendly transmission rate control, does guarantee flow control to receiving nodes.NORM receiver applications learn of active senders and their corresponding pending and completed data transfers, etc via the API event dispatching mechanism. By default, NORM receivers use NACK messages to request repair of transmitted content from the originating sender as needed to achieve reliable transfer. Some API functions are available to provide some additional control over the NACKing behavior, such as initially NACKing for
NORM_INFOcontent only or even to the extent of disabling receiver feedback (silent receiver or emission-controlled (EMCON) operation) entirely. Otherwise, the parameters and operation of reliable data transmission are left to sender applications and receivers learn of sender parameters in NORM protocol message headers and are instructed byNORM_CMDmessages from the sender(s).With respect to the NORM API, the receiver application is informed of new senders and receive data objects via the the
NORM_REMOTE_SENDER_NEWandNORM_RX_OBJECT_NEWnotifications, respectfully. Additionally, object reception progress is indicated with theNORM_RX_OBJECT_UPDATEDnotification and this also serves as an indicator for theNORM_OBJECT_STREAMtype that the receive application should make calls toNormStreamRead()to read newly received stream content. NORM sender status is also conveyed via theNORM_REMOTE_SENDER_ACTIVEand NORM_REMOTE_SENDER_INACTIVE notifications. For example, the receiver application may use theNORM_REMOTE_SENDER_INACTIVEas a cue to make calls toNormNodeFreeBuffers()and/orNormNodeDelete()to free memory resources allocated for buffering received content for the given sender. The amount of memory allocated per sender is set in theNormStartReceiver()call.An asynchronous event dispatching mechanism is provided to notify the application of significant NORM protocol events. The centerpiece of this is the
NormGetNextEvent()function that can be used to retrieve the next NORM protocol engine event in the form of aNormEventstructure. This function will typically block until aNormEventoccurs. However, non-blocking operation may be achieved by using theNormGetDescriptor()call to get a NormDescriptor (file descriptor) value (Unix int or Win32 HANDLE) suitable for use in a asynchronous I/O monitoring functions such as the Unixselect()or Win32MsgWaitForMultipleObjects()system calls. The a NormDescriptor will be signaled when aNormEventis available. For Win32 platforms, dispatching of a user-defined Windows message for NORM event notification is also planned for a future update to the NORM API.To build applications that use the NORM library, a path to the "normApi.h" header file must be provided and the linker step needs to reference the NORM library file ("
libnorm.a" for Unix platforms and "Norm.lib" for Win32 platforms). NORM also depends upon the NRL Protean Protocol Prototyping toolkit "Protokit" library (a.k.a "Protolib") (static library files "libProtokit.a" for Unix and "Protokit.lib" for Win32). Shared or dynamically-linked versions of these libraries may also be built from the NORM source code or provided. Depending upon the platform, some additional library dependencies may be required to support the needs of NORM and/or Protokit. These are described below.The "makefiles" directory contains Unix Makefiles for various platforms the "win32" and "wince" sub-directories there contain Microsoft Visual C++ (VC++) and Embedded VC++ project files for building the NORM implementation. Additionally, a "waf" (Python-based build tool) build option is supported that can be used to build and install the NORM library code on the supported platforms. Finally, Python and Java bindings to the NORM API are included and "src/python" and "src/java" directories contain the code for these and the "makefiles/java" directory contains Makefiles to build the NORM Java JNI bindings. Note the "waf" tool can also be used to build the Java and Python bindings.
NORM has been built and tested on Linux (various architectures), MacOS (BSD), Solaris, and IRIX (SGI) platforms. The code should be readily portable to other Unix platforms.
To support IPv6 operation, the NORM and the Protokit library must be compiled with the "
HAVE_IPV6" macro defined. This is default in the NORM and Protokit Makefiles for platforms that support IPv6. It is important that NORM and Protokit be built with this macro defined the same. With NORM, it is recommended that "large file support" options be enabled when possible.The NORM API uses threading so that the NORM protocol engine may run independent of the application. Thus the "POSIX Threads" library must be included ("-pthread") in the linking step. MacOS/BSD also requires the addition of the "-lresolv" (resolver) library and Solaris requires the dynamic loader, network/socket, and resolver libraries ("-lnsl -lsocket -lresolv") to achieve successful compilation. The Makefiles in the NORM source code distribution are a reference for these requirements. Note that MacOS 9 and earlier are not supported.
Additionally, it is critical that the _
FILE_OFFSET_BITSmacro be consistently defined for the NORM library build and the application build using the library. The distributed NORM Makefiles have-D_FILE_OFFSET_BITS=64set in the compilation to enable "large file support". Applications built using NORM should have the same compilation option set to operate correctly (The definition of theNormSizetype in "normApi.h" depends upon this compilation flag).NORM has been built using Microsoft's Visual C++ (6.0 and .NET) and Embedded VC++ 4.2 environments. In addition to proper macro definitions (e.g., HAVE_IPV6, etc) that are included in the respective "Protokit" and "NORM" project files, it is important that common code generation settings be used when building the NORM application. The NORM and Protokit projects are built with the "Multi-threading DLL" library usage set. The NORM API requires multi-threading support. This is a critical setting and numerous compiler and linker errors will result if this is not properly set for your application project.
NORM and Protokit also depend on the Winsock 2.0 ("
ws2_32.lib" (or "ws2.lib" (WinCE)) and the IP Helper API ("iphlpapi.lib") libraries and these must be included in the project "Link" attributes.An additional note is that a bug in VC++ 6.0 and earlier compilers (includes embedded VC++ 4.x compilers) prevent compilation of Protokit-based code with debugging capabilities enabled. However, this has been resolved in VC++ .NET and is hoped to be resolved in the future for the WinCE build tools.
Operation on Windows NT4 (and perhaps other older Windows operating systems) requires that the compile time macro
WINVER=0x0400defined. This is because the version of the IP Helper API library (iphlpapi.lib) used by Protolib (and hence NORM) for this system doesn't support some of the functions defined for this library. This may be related to IPv6 support issues so it may be possible that the Protolib build could be tweaked to provide a single binary executable suitable for IPv4 operation only across a large range of Windows platforms.This section provides a reference to the NORM API variable types, constants and functions.
The NORM API defines and enumerates a number of supporting variable types and values which are used in different function calls. The variable types are described here.
The
NormInstanceHandletype is returned when a NORM API instance is created (seeNormCreateInstance()). This handle can be subsequently used for API calls which require reference to a specific NORM API instance. By default, each NORM API instance instantiated creates an operating system thread for protocol operation. Note that multiple NORM transport sessions may be created for a single API instance. In general, it is expected that applications will create a single NORM API instance, but some multi-threaded application designs may prefer multiple corresponding NORM API instances. The valueNORM_INSTANCE_INVALIDcorresponds to an invalid API instance.The
NormSessionHandletype is used to reference NORM transport sessions which have been created using theNormCreateSession()API call. MultipleNormSessionHandlevalues may be associated with a givenNormInstanceHandle. The special valueNORM_SESSION_INVALIDis used to refer to invalid session references.The
NormSessionIdtype is used by applications to uniquely identify their instance of participation as a sender within a NormSession. This type is a parameter to theNormStartSender()function. Robust applications can use differentNormSessionIdvalues when initiating sender operation so that receivers can discriminate when a sender has terminated and restarted (whether intentional or due to system failure). For example, an application could cache its priorNormSessionIdvalue in non-volatile storage which could then be recovered and incremented (for example) upon system restart to produce a new value. TheNormSessionIdvalue is used for the value of the instance_id field in NORM protocol sender messages (see the NORM protocol specification) and receivers use this field to detect sender restart within a NormSession.The
NormNodeHandletype is used to reference state kept by the NORM implementation with respect to other participants within a NormSession. Most typically, theNormNodeHandleis used by receiver applications to dereference information about remote senders of data as needed. The special valueNORM_NODE_INVALIDcorresponds to an invalid reference.The
NormNodeIdtype corresponds to a 32-bit numeric value which should uniquely identify a participant (node) in a given NormSession. TheNormNodeGetId()function can be used to retrieve this value given a validNormNodeHandle. The special valueNORM_NODE_NONEcorresponds to an invalid (or null) node while the valueNORM_NODE_ANYserves as a wild card value for some functions.The
NormObjectHandletype is used to reference state kept for data transport objects being actively transmitted or received. The state kept for NORM transport objects is temporary, but the NORM API provides a function to persistently retain state associated with a sender or receiverNormObjectHandle(seeNormObjectRetain()) if needed. For sender objects, unless explicitly retained, theNormObjectHandlecan be considered valid until the referenced object is explicitly canceled (seeNormObjectCancel()) or purged from the sender transmission queue (see the eventNORM_TX_OBJECT_PURGED). For receiver objects, these handles should be treated as valid only until a subsequent call toNormGetNextEvent()unless, again, specifically retained. The special valueNORM_OBJECT_INVALIDcorresponds to an invalid transport object reference.The
NormObjectTypetype is an enumeration of possible NORM data transport object types. As previously mentioned, valid types include:
NORM_OBJECT_FILE
NORM_OBJECT_DATA, and
NORM_OBJECT_STREAMGiven a
NormObjectHandle, the application may determine an object's type using theNormObjectGetType()function call. A specialNormObjectTypevalue,NORM_OBJECT_NONE, indicates an invalid object type.The
NormSizeis the type used for NormObject size information. For example, theNormObjectGetSize()function returns a value of typeNormSize. The range ofNormSizevalues depends upon the operating system and NORM library compilation settings. With "large file support" enabled, as is the case with distributed NORM library "Makefiles", theNormSizetype is a 64-bit integer. However, some platforms may support only 32-bit object sizes.The
NormObjectTransportIdtype is a 16-bit numerical value assigned to NormObjects by senders during active transport. These values are temporarily unique with respect to a given sender within a NormSession and may be "recycled" for use for future transport objects. NORM sender nodes assign these values in a monotonically increasing fashion during the course of a session as part of protocol operation. Typically, the application should not need access to these values, but an API call such asNormObjectGetTransportId()(TBD) may be provided to retrieve these values if needed. (Note this type may be deprecated; i.e., it may not be needed at since theNormRequeueObject()function is implemented using handles only, but _some_ applications requiring persistence even after a system reboot may need the ability to recall previous transport ids?)The
NormEventTypeis an enumeration of NORM API events. "Events" are used by the NORM API to signal the application of significant NORM protocol operation events (e.g., receipt of a new receive object, etc). A description of possibleNormEventTypevalues and their interpretation is given below. The function callNormGetNextEvent()is used to retrieve events from the NORM protocol engine.The
NormEventtype is a structure used to describe significant NORM protocol events. This structure is defined as follows:typedef struct { NormEventType type;NormSessionHandlesession; @@ -64,7 +64,7 @@ voidNormGetUserData(NormSessionHandlesessionHandle);This function retrieves the "user data" value set for the specified
sessionHandlewith a prior call toNormSetUserData().#include <normApi.h> -NormNodeIdNormGetLocalNodeId(NormSessionHandlesessionHandle);This function retrieves the
NormNodeIdvalue used for the application's participation in the NormSession identified by thesessionHandleparameter. The value may have been explicitly set during theNormCreateSession()call or may have been automatically derived using the host computer's "default" IP network address.#include <normApi.h> +NormNodeIdNormGetLocalNodeId(NormSessionHandlesessionHandle);This function retrieves the
NormNodeIdvalue used for the application's participation in the NormSession identified by thesessionHandleparameter. The value may have been explicitly set during theNormCreateSession()call or may have been automatically derived using the host computer's "default" IP network address.#include <normApi.h> boolNormSetTxPort(NormSessionHandlesessionHandle, unsigned short txPort, @@ -84,264 +84,267 @@ voidNormSetMulticastInterface(NormSessionHandlesession, const char* interfaceName);This function specifies which host network interface is used for IP Multicast transmissions and group membership. This should be called before any call to
NormStartSender()orNormStartReceiver()is made so that the IP multicast group is joined on the proper host interface. However, if a call toNormSetMulticastInterface()is made after either of these function calls, the call will not affect the group membership interface, but only dictate that a possibly different network interface is used for transmitted NORM messages. Thus, the code:NormSetMulticastInterface(session, "interface1");NormStartReceiver(session, ...);-NormSetMulticastInterface(session, "interface2");will result in NORM group membership (i.e. multicast reception) being managed on "
interface1" while NORM multicast transmissions are made via "interface2".A return value of
trueindicates success while a return value offalseindicates that the specified interface was valid. This function will always returntrueif made before calls toNormStartSender()orNormStartReceiver(). However, those calls may fail if an invalid interface was specified with the call described here.#include <normApi.h> +NormSetMulticastInterface(session, "interface2");will result in NORM group membership (i.e. multicast reception) being managed on "
interface1" while NORM multicast transmissions are made via "interface2".A return value of
trueindicates success while a return value offalseindicates that the specified interface was invalid. This function will always returntrueif made before calls toNormStartSender()orNormStartReceiver(). However, those calls may fail if an invalid interface was specified with the call described here.#include <normApi.h> -boolNormSetTTL(NormSessionHandlesession, - unsigned char ttl);This function specifies the time-to-live (
ttl) for IP Multicast datagrams generated by NORM for the specifiedsessionHandle. The IP TTL field limits the number of router "hops" that a generated multicast packet may traverse before being dropped. For example, if TTL is equal to one, the transmissions will be limited to the local area network (LAN) of the host computers network interface. Larger TTL values should be specified to span large networks. Also note that some multicast router configurations use artificial "TTL threshold" values to constrain some multicast traffic to an administrative boundary. In these cases, the NORM TTL setting must also exceed the router "TTL threshold" in order for the NORM traffic to be allowed to exit the administrative area.A return value of
trueindicates success while a return value offalseindicates that the specifiedttlcould not be set. This function will always returntrueif made before calls toNormStartSender()orNormStartReceiver(). However, those calls may fail if the desiredttlvalue cannot be set.#include <normApi.h> +boolNormSetSSM(NormSessionHandlesession, + const char* sourceAddress);This function sets the source address for Source-Specific Multicast (SSM) operation. This should be called before any call to
NormStartSender()orNormStartReceiver()is made so that the proper group join is done. The receiver application MUST also use theNormSetDefaultUnicastNack()call so that feedback traffic is directed back to appropriate sender.A return value of
trueindicates success while a return value offalseindicates that the specified source address was invalid. Note that if a valid IP address is specified but is improper for SSM (e.g., an IP multicast address) the later calls toNormStartSender()orNormStartReceiver()may fail.#include <normApi.h> -boolNormSetTOS(NormSessionHandlesessionHandle, - unsigned char tos);This function specifies the type-of-service (
tos) field value used in IP Multicast datagrams generated by NORM for the specifiedsessionHandle. The IP TOS field value can be used as an indicator that a "flow" of packets may merit special Quality-of-Service (QoS) treatment by network devices. Users should refer to applicable QoS information for their network to determine the expected interpretation and treatment (if any) of packets with explicit TOS marking.A return value of
trueindicates success while a return value offalseindicates that the specifiedtoscould not be set. This function will always returntrueif made before calls toNormStartSender()orNormStartReceiver(). However, those calls may fail if the desiredtosvalue cannot be set.#include <normApi.h> +boolNormSetTTL(NormSessionHandlesession, + unsigned char ttl);This function specifies the time-to-live (
ttl) for IP Multicast datagrams generated by NORM for the specifiedsessionHandle. The IP TTL field limits the number of router "hops" that a generated multicast packet may traverse before being dropped. For example, if TTL is equal to one, the transmissions will be limited to the local area network (LAN) of the host computers network interface. Larger TTL values should be specified to span large networks. Also note that some multicast router configurations use artificial "TTL threshold" values to constrain some multicast traffic to an administrative boundary. In these cases, the NORM TTL setting must also exceed the router "TTL threshold" in order for the NORM traffic to be allowed to exit the administrative area.A return value of
trueindicates success while a return value offalseindicates that the specifiedttlcould not be set. This function will always returntrueif made before calls toNormStartSender()orNormStartReceiver(). However, those calls may fail if the desiredttlvalue cannot be set.#include <normApi.h> -voidNormSetLoopback(NormSessionHandlesessionHandle, - bool loopbackEnable);This function enables or disables loopback operation for the indicated NORM
sessionHandle. IfloopbackEnableis set totrue, loopback operation is enabled which allows the application to receive its own message traffic. Thus, an application which is both actively receiving and sending may receive its own transmissions. Note it is expected that this option would be principally be used for test purposes and that applications would generally not need to transfer data to themselves. IfloopbackEnableis false, the application is prevented from receiving its own NORM message transmissions. By default, loopback operation is disabled when a NormSession is created.#include <normApi.h> +boolNormSetTOS(NormSessionHandlesessionHandle, + unsigned char tos);This function specifies the type-of-service (
tos) field value used in IP Multicast datagrams generated by NORM for the specifiedsessionHandle. The IP TOS field value can be used as an indicator that a "flow" of packets may merit special Quality-of-Service (QoS) treatment by network devices. Users should refer to applicable QoS information for their network to determine the expected interpretation and treatment (if any) of packets with explicit TOS marking.A return value of
trueindicates success while a return value offalseindicates that the specifiedtoscould not be set. This function will always returntrueif made before calls toNormStartSender()orNormStartReceiver(). However, those calls may fail if the desiredtosvalue cannot be set.#include <normApi.h> -boolNormSetFragmentation(NormSessionHandlesessionHandle, - bool fragmentation);This function sets an underlying socket option that enables or disables IP datagram fragmentation by network intermediate systems according to whether the
fragmentationparameter is set to a value oftrueorfalse, respectively. If set totrueto enable fragmentation, the DF (don't fragment) bit of the headers of NORM UDP/IP packets sent will be cleared. Otherwise the DF bit is set and packets will not be fragmented by network devices if they exceed a link Maximum Transmission Unit (MTU) and will instead be dropped. For IP Multicast destinations, some operating systems may always set the DF bit of transmitted packets, regardless of the setting here and the underlying socket option status. Typically, the DF bit is set (i.e., fragmentation disabled) by default on most operating systems.This call is not currently functional on the Mac OSX system that does not support the needed
IP_MTU_DISCOVERorIP_DONTFRAGsocket options.The functions described in this section apply only to NORM sender operation. Applications may participate strictly as senders or as receivers, or may act as both in the context of a NORM protocol session. The NORM sender is responsible for most parameters pertaining to its transmission of data. This includes transmission rate, data segmentation sizes, FEC coding parameters, stream buffer sizes, etc.
#include <normApi.h> +voidNormSetLoopback(NormSessionHandlesessionHandle, + bool loopbackEnable);This function enables or disables loopback operation for the indicated NORM
sessionHandle. IfloopbackEnableis set totrue, loopback operation is enabled which allows the application to receive its own message traffic. Thus, an application which is both actively receiving and sending may receive its own transmissions. Note it is expected that this option would be principally be used for test purposes and that applications would generally not need to transfer data to themselves. IfloopbackEnableis false, the application is prevented from receiving its own NORM message transmissions. By default, loopback operation is disabled when a NormSession is created.#include <normApi.h> + +boolNormSetFragmentation(NormSessionHandlesessionHandle, + bool fragmentation);This function sets an underlying socket option that enables or disables IP datagram fragmentation by network intermediate systems according to whether the
fragmentationparameter is set to a value oftrueorfalse, respectively. If set totrueto enable fragmentation, the DF (don't fragment) bit of the headers of NORM UDP/IP packets sent will be cleared. Otherwise the DF bit is set and packets will not be fragmented by network devices if they exceed a link Maximum Transmission Unit (MTU) and will instead be dropped. For IP Multicast destinations, some operating systems may always set the DF bit of transmitted packets, regardless of the setting here and the underlying socket option status. Typically, the DF bit is set (i.e., fragmentation disabled) by default on most operating systems.This call is not currently functional on the Mac OSX system that does not support the needed
IP_MTU_DISCOVERorIP_DONTFRAGsocket options.The functions described in this section apply only to NORM sender operation. Applications may participate strictly as senders or as receivers, or may act as both in the context of a NORM protocol session. The NORM sender is responsible for most parameters pertaining to its transmission of data. This includes transmission rate, data segmentation sizes, FEC coding parameters, stream buffer sizes, etc.
#include <normApi.h> boolNormStartSender(NormSessionHandlesessionHandle,NormSessionIdinstanceId, unsigned long bufferSpace, unsigned short segmentSize, unsigned char blockSize, - unsigned char numParity);The application's participation as a sender within a specified NormSession begins when this function is called. This includes protocol activity such as congestion control and/or group round-trip timing (GRTT) feedback collection and application API activity such as posting of sender-related
NormEventnotifications. The parameters required for this function call include:
sessionHandleThis must be a valid
NormSessionHandlepreviously obtained with a call toNormCreateSession().
instanceIdApplication-defined value used as the
instance_idfield of NORM sender messages for the application's participation within a session. Receivers can detect when a sender has terminated and restarted if the application uses differentinstanceIdvalues when initiating sender operation. For example, a robust application could cache previousinstanceIdvalues in non-volatile storage and gracefully recover (without confusing receivers) from a total system shutdown and reboot by using a newinstanceIdvalue upon restart.
bufferSpaceThis specifies the maximum memory space (in bytes) the NORM protocol engine is allowed to use to buffer any sender calculated FEC segments and repair state for the session. The optimum
bufferSpacevalue is function of the network topology bandwidth*delay product and packet loss characteristics. If thebufferSpacelimit is too small, the protocol may operate less efficiently as the sender is required to possibly recalculate FEC parity segments and/or provide less efficient repair transmission strategies (resort to explicit repair) when state is dropped due to constrained buffering resources. However, note the protocol will still provide reliable transfer. A largebufferSpaceallocation is safer at the expense of possibly committing more memory resources.
segmentSizeThis parameter sets the maximum payload size (in bytes) of NORM sender messages (not including any NORM message header fields). A sender's
segmentSizevalue is also used by receivers to limit the payload content of some feedback messages (e.g.NORM_NACKmessage content, etc.) generated in response to that sender. Note different senders within a NormSession may use different segmentSize values. Generally, the appropriate segment size to use is dependent upon the types of networks forming the multicast topology, but applications may choose different values for other purposes. Note that application designers MUST account for the size of NORM message headers when selecting asegmentSize. For example, theNORM_DATAmessage header for aNORM_OBJECT_STREAMwith full header extensions is 48 bytes in length. In this case, the UDP payload size of these messages generated by NORM would be up to (48 +segmentSize) bytes.
blockSizeThis parameter sets the number of source symbol segments (packets) per coding block, for the systematic Reed-Solomon FEC code used in the current NORM implementation. For traditional systematic block code "(n,k)" nomenclature, the
blockSizevalue corresponds to "k". NORM logically segments transport object data content into coding blocks and theblockSizeparameter determines the number of source symbol segments (packets) comprising a single coding block where each source symbol segment is up tosegmentSizebytes in length.. A given block's parity symbol segments are calculated using the corresponding set of source symbol segments. The maximumblockSizeallowed by the 8-bit Reed-Solomon codes in NORM is255, with the further limitation that (blockSize+numParity) <=255.
numParityThis parameter sets the maximum number of parity symbol segments (packets) the sender is willing to calculate per FEC coding block. The parity symbol segments for a block are calculated from the corresponding
blockSizesource symbol segments. In the "(n,k)" nomenclature mention above, thenumParityvalue corresponds to "n - k". A property of the Reed-Solomon FEC codes used in the current NORM implementation is that one parity segment can fill any one erasure (missing segment (packet)) for a coding block. For a givenblockSize, the maximum numParity value is (255-blockSize). However, note that computational complexity increases significantly with increasingnumParityvalues and applications may wish to be conservative with respect tonumParityselection, given anticipated network packet loss conditions and group size scalability concerns. Additional FEC code options may be provided for this NORM implementation in the future with different parameters, capabilities, trade-offs, and computational requirements.These parameters are currently immutable with respect to a sender's participation within a NormSession. Sender operation must be stopped (see
NormStopSender()) and restarted with another call toNormStartSender()if these parameters require alteration. The API may be extended in the future to support additional flexibility here, if required. For example, the NORM protocol "intance_id" field may possibly be leveraged to permit a node to establish multiple virtual presences as a sender within a NormSession in the future. This would allow the sender to provide multiple concurrent streams of transport, with possibly different FEC and other parameters if appropriate within the context of a single NormSession. Again, this extended functionality is not yet supported in this implementation.A value of
trueis returned upon success andfalseupon failure. The reasons failure may occur include limited system resources or that the network sockets required for communication failed to open or properly configure. (TBD - Provide aNormGetError(NormSessionHandlesessionHandle) function to retrieve a more specific error indication for this and other functions.)The application's participation as a sender within a specified NormSession begins when this function is called. This includes protocol activity such as congestion control and/or group round-trip timing (GRTT) feedback collection and application API activity such as posting of sender-related
NormEventnotifications. The parameters required for this function call include:
sessionHandleThis must be a valid
NormSessionHandlepreviously obtained with a call toNormCreateSession().
instanceIdApplication-defined value used as the
instance_idfield of NORM sender messages for the application's participation within a session. Receivers can detect when a sender has terminated and restarted if the application uses differentinstanceIdvalues when initiating sender operation. For example, a robust application could cache previousinstanceIdvalues in non-volatile storage and gracefully recover (without confusing receivers) from a total system shutdown and reboot by using a newinstanceIdvalue upon restart.
bufferSpaceThis specifies the maximum memory space (in bytes) the NORM protocol engine is allowed to use to buffer any sender calculated FEC segments and repair state for the session. The optimum
bufferSpacevalue is function of the network topology bandwidth*delay product and packet loss characteristics. If thebufferSpacelimit is too small, the protocol may operate less efficiently as the sender is required to possibly recalculate FEC parity segments and/or provide less efficient repair transmission strategies (resort to explicit repair) when state is dropped due to constrained buffering resources. However, note the protocol will still provide reliable transfer. A largebufferSpaceallocation is safer at the expense of possibly committing more memory resources.
segmentSizeThis parameter sets the maximum payload size (in bytes) of NORM sender messages (not including any NORM message header fields). A sender's
segmentSizevalue is also used by receivers to limit the payload content of some feedback messages (e.g.NORM_NACKmessage content, etc.) generated in response to that sender. Note different senders within a NormSession may use different segmentSize values. Generally, the appropriate segment size to use is dependent upon the types of networks forming the multicast topology, but applications may choose different values for other purposes. Note that application designers MUST account for the size of NORM message headers when selecting asegmentSize. For example, theNORM_DATAmessage header for aNORM_OBJECT_STREAMwith full header extensions is 48 bytes in length. In this case, the UDP payload size of these messages generated by NORM would be up to (48 +segmentSize) bytes.
blockSizeThis parameter sets the number of source symbol segments (packets) per coding block, for the systematic Reed-Solomon FEC code used in the current NORM implementation. For traditional systematic block code "(n,k)" nomenclature, the
blockSizevalue corresponds to "k". NORM logically segments transport object data content into coding blocks and theblockSizeparameter determines the number of source symbol segments (packets) comprising a single coding block where each source symbol segment is up tosegmentSizebytes in length.. A given block's parity symbol segments are calculated using the corresponding set of source symbol segments. The maximumblockSizeallowed by the 8-bit Reed-Solomon codes in NORM is255, with the further limitation that (blockSize+numParity) <=255.
numParityThis parameter sets the maximum number of parity symbol segments (packets) the sender is willing to calculate per FEC coding block. The parity symbol segments for a block are calculated from the corresponding
blockSizesource symbol segments. In the "(n,k)" nomenclature mention above, thenumParityvalue corresponds to "n - k". A property of the Reed-Solomon FEC codes used in the current NORM implementation is that one parity segment can fill any one erasure (missing segment (packet)) for a coding block. For a givenblockSize, the maximum numParity value is (255-blockSize). However, note that computational complexity increases significantly with increasingnumParityvalues and applications may wish to be conservative with respect tonumParityselection, given anticipated network packet loss conditions and group size scalability concerns. Additional FEC code options may be provided for this NORM implementation in the future with different parameters, capabilities, trade-offs, and computational requirements.These parameters are currently immutable with respect to a sender's participation within a NormSession. Sender operation must be stopped (see
NormStopSender()) and restarted with another call toNormStartSender()if these parameters require alteration. The API may be extended in the future to support additional flexibility here, if required. For example, the NORM protocol "intance_id" field may possibly be leveraged to permit a node to establish multiple virtual presences as a sender within a NormSession in the future. This would allow the sender to provide multiple concurrent streams of transport, with possibly different FEC and other parameters if appropriate within the context of a single NormSession. Again, this extended functionality is not yet supported in this implementation.A value of
trueis returned upon success andfalseupon failure. The reasons failure may occur include limited system resources or that the network sockets required for communication failed to open or properly configure. (TBD - Provide aNormGetError(NormSessionHandlesessionHandle) function to retrieve a more specific error indication for this and other functions.)#include <normApi.h> voidNormStopSender(NormSessionHandlesessionHandle, - bool graceful = false);This function terminates the application's participation in a NormSession as a sender. By default, the sender will immediately exit the session identified by the
sessionHandleparameter without notifying the receiver set of its intention. However a "graceful shutdown" option, enabled by setting thegracefulparameter to true, is provided to terminate sender operation gracefully, notifying the receiver set its pending exit with appropriate protocol messaging. ANormEvent,NORM_LOCAL_SENDER_CLOSED, is dispatched when the graceful shutdown process has completed.This function terminates the application's participation in a NormSession as a sender. By default, the sender will immediately exit the session identified by the
sessionHandleparameter without notifying the receiver set of its intention. However a "graceful shutdown" option, enabled by setting thegracefulparameter to true, is provided to terminate sender operation gracefully, notifying the receiver set its pending exit with appropriate protocol messaging. ANormEvent,NORM_LOCAL_SENDER_CLOSED, is dispatched when the graceful shutdown process has completed.#include <normApi.h> voidNormSetTxRate(NormSessionHandlesessionHandle, - double rate);This function sets the transmission
rate(in bits per second (bps)) limit used for NormSender transmissions for the givensessionHandle. For fixed-rate transmission ofNORM_OBJECT_FILEorNORM_OBJECT_DATA, this limit determines the data rate at which NORM protocol messages and data content are sent. ForNORM_OBJECT_STREAMtransmissions, this is the maximum rate allowed for transmission (i.e. if the application writes to the stream at a lower rate, a lower average NORM transmission rate will occur). Note that the application will need to consider the overhead of NORM protocol headers when determining an appropriate transmission rate for its purposes. When NORM congestion control is enabled (seeNormSetCongestionControl()), therateset here will be set, but congestion control operation, if enabled, may quickly readjust the transmission rate.This function sets the transmission
rate(in bits per second (bps)) limit used for NormSender transmissions for the givensessionHandle. For fixed-rate transmission ofNORM_OBJECT_FILEorNORM_OBJECT_DATA, this limit determines the data rate at which NORM protocol messages and data content are sent. ForNORM_OBJECT_STREAMtransmissions, this is the maximum rate allowed for transmission (i.e. if the application writes to the stream at a lower rate, a lower average NORM transmission rate will occur). Note that the application will need to consider the overhead of NORM protocol headers when determining an appropriate transmission rate for its purposes. When NORM congestion control is enabled (seeNormSetCongestionControl()), therateset here will be set, but congestion control operation, if enabled, may quickly readjust the transmission rate.#include <normApi.h> -doubleNormGetTxRate(NormSessionHandlesessionHandle);This function retrieves the current sender transmission rate in units of bits per second (bps) for the given
sessionHandle. When NORM congestion control is enabled (seeNormSetCongestionControl()), this reflects the current rate set (or suggested) by NORM congestion control operation. Otherwise, this returns the rate that was set with theNormSetTxRate()call.#include <normApi.h> +doubleNormGetTxRate(NormSessionHandlesessionHandle);This function retrieves the current sender transmission rate in units of bits per second (bps) for the given
sessionHandle. When NORM congestion control is enabled (seeNormSetCongestionControl()), this reflects the current rate set (or suggested) by NORM congestion control operation. Otherwise, this returns the rate that was set with theNormSetTxRate()call.#include <normApi.h> boolNormSetTxSocketBuffer(NormSessionHandlesessionHandle, - unsigned int bufferSize);This function can be used to set a non-default socket buffer size for the UDP socket used by the specified NORM
sessionHandlefor data transmission. ThebufferSizeparameter specifies the desired socket buffer size in bytes. Large transmit socket buffer sizes may be necessary to achieve high transmission rates when NORM, as a user-space process, is unable to precisely time its packet transmissions. Similarly, NORM receivers may need to set large receive socket buffer sizes to achieve successful, sustained high data rate reception (seeNormSetRxSocketBuffer()). Typically, it is more important to set the receive socket buffer size (seeNormSetRxSocketBuffer()) as this maintains reliability (i.e. by avoiding receive socket buffer overflow) at high data rates while setting a larger transmit socket buffer size allows higher average transmission rates to be achieved.This function returns
trueupon success andfalseupon failure. Possible failure modes include an invalidsessionHandleparameter, a call toNormStartReceiver()orNormStartSender()has not yet been made for the session, or an invalidbufferSizewas given. Note some operating systems may require additional system configuration to use non-standard socket buffer sizes.This function can be used to set a non-default socket buffer size for the UDP socket used by the specified NORM
sessionHandlefor data transmission. ThebufferSizeparameter specifies the desired socket buffer size in bytes. Large transmit socket buffer sizes may be necessary to achieve high transmission rates when NORM, as a user-space process, is unable to precisely time its packet transmissions. Similarly, NORM receivers may need to set large receive socket buffer sizes to achieve successful, sustained high data rate reception (seeNormSetRxSocketBuffer()). Typically, it is more important to set the receive socket buffer size (seeNormSetRxSocketBuffer()) as this maintains reliability (i.e. by avoiding receive socket buffer overflow) at high data rates while setting a larger transmit socket buffer size allows higher average transmission rates to be achieved.This function returns
trueupon success andfalseupon failure. Possible failure modes include an invalidsessionHandleparameter, a call toNormStartReceiver()orNormStartSender()has not yet been made for the session, or an invalidbufferSizewas given. Note some operating systems may require additional system configuration to use non-standard socket buffer sizes.#include <normApi.h> voidNormSetFlowControl(NormSessionHandlesessionHandle, - double flowControlFactor);This function controls a scaling factor that is used for sender timer-based flow control for the the specified NORM
sessionHandle. Timer-based flow control works by preventing the NORM sender application from enqueueing new transmit objects or stream data that would purge "old" objects or stream data when there has been recent NACK activity for those old objects or data. If theflowControlFactoris set toZERO, then the flow control mechanism is effectively disabled. LargerflowControlFactorvalues enforce more robust flow control by forcing the sender to maintain state longer, but then larger transmit buffer, stream buffer, transmit cache bounds and receive cache limits (seeNormStartSender(),NormStreamOpen(),NormSetTxCacheBounds(), andNormSetRxCacheLimit(), respectively) may be needed to maintain throughput in larger <delay*bandwidth, loss> conditions. Effectively, a largerflowControlFactorcan favor reliability over throughput when buffer-constrained.The
flowControlFactoris used to compute a delay time for when a sender buffered object (or block of stream data) may be released (i.e. purged) after transmission or applicable NACKs reception. The delay time function is:flowControlDelay = flowControlFactor * GRTT * (backoffFactor + 1)where the "
GRTT" is the sender's advertised GRTT estimate and thebackoffFactoris the sender's configured timer-based feedback scaling factor.The default value (when this function is not called) of the
flowControlFactoris2.0. Note that a NORM application can also implement more explicit, deterministic flow control through use of theNormSetWatermark()API call, potentially even requiring positive acknowledgement of older data before enqueueing new data. Note that using theNormSetWatermark()API call with aNORM_NODE_NONEmember in acking node list to force a "full" watermark flush is somewhat equivalent to timer-based flow control with aflowControlFactorequal to2.0 * txRobustFactor.If such explicit flow control is implemented by the application, then a reduced
flowControlFactor(or evenZERO) may be used. If "push mode" is enabled for aNORM_OBJECT_STREAM(seeNormStreamSetPushEnable()), then flow control has no effect for the stream.This function controls a scaling factor that is used for sender timer-based flow control for the the specified NORM
sessionHandle. Timer-based flow control works by preventing the NORM sender application from enqueueing new transmit objects or stream data that would purge "old" objects or stream data when there has been recent NACK activity for those old objects or data. If theflowControlFactoris set toZERO, then the flow control mechanism is effectively disabled. LargerflowControlFactorvalues enforce more robust flow control by forcing the sender to maintain state longer, but then larger transmit buffer, stream buffer, transmit cache bounds and receive cache limits (seeNormStartSender(),NormStreamOpen(),NormSetTxCacheBounds(), andNormSetRxCacheLimit(), respectively) may be needed to maintain throughput in larger <delay*bandwidth, loss> conditions. Effectively, a largerflowControlFactorcan favor reliability over throughput when buffer-constrained.The
flowControlFactoris used to compute a delay time for when a sender buffered object (or block of stream data) may be released (i.e. purged) after transmission or applicable NACKs reception. The delay time function is:flowControlDelay = flowControlFactor * GRTT * (backoffFactor + 1)where the "
GRTT" is the sender's advertised GRTT estimate and thebackoffFactoris the sender's configured timer-based feedback scaling factor.The default value (when this function is not called) of the
flowControlFactoris2.0. Note that a NORM application can also implement more explicit, deterministic flow control through use of theNormSetWatermark()API call, potentially even requiring positive acknowledgement of older data before enqueueing new data. Note that using theNormSetWatermark()API call with aNORM_NODE_NONEmember in acking node list to force a "full" watermark flush is somewhat equivalent to timer-based flow control with aflowControlFactorequal to2.0 * txRobustFactor.If such explicit flow control is implemented by the application, then a reduced
flowControlFactor(or evenZERO) may be used. If "push mode" is enabled for aNORM_OBJECT_STREAM(seeNormStreamSetPushEnable()), then flow control has no effect for the stream.#include <normApi.h> voidNormSetCongestionControl(NormSessionHandlesessionHandle, bool enable, - bool adjustRate = true);This function enables (or disables) the NORM sender congestion control operation for the session designated by the
sessionHandleparameter. For best operation, this function should be called before the call toNormStartSender()is made, but congestion control operation can be dynamically enabled/disabled during the course of sender operation. If the value of theenableparameter istrue, congestion control operation is enabled while it is disabled for enable equal tofalse. When congestion control operation is enabled, the NORM sender automatically adjusts its transmission rate based on feedback from receivers. If bounds on transmission rate have been set (seeNormSetTxRateBounds()) the rate adjustment will remain within the set bounds. The application will be notified of any changes to the sender transmission rate via aNormEventof typeNORM_TX_RATE_CHANGED.The rate set by
NormSetTxRate()has no effect when congestion control operation is enabled, unless theadjustRateparameter here is set tofalse. When theadjustRateparameter is set tofalse, the NORM Congestion Control operates as usual, with feedback collected from the receiver set and the "current limiting receiver" identified, except that no actual adjustment is made to the sender's transmission rate. I.e., the transmission rate that was set byNormSetTxRate()is observed by the sender regardless of the feedback received. TheNORM_TX_RATE_CHANGEDnotification will still occur as if the rate were being adjusted and the value returned byNormGetTxRate()reflects the rate that would have been used had theadjustRateparameter been enabled even though no actual rate change has occurred. The purpose of this variation of NORM Congestion Control operation is to allow applications to get a "suggested" rate from the NORM-CC mechanism. But, it is important to note that this "suggested" rate may or may not be appropriate since the operation of the NORM-CC algorithm is somewhat dependent on the associated NORM sender load on the network. For example, the "suggested" rate may be artificially high if the sender application has not been correspondingly setting the rate and actively transmitting data at that rate. This optional mode of operation is provided for EXPERIMENTAL purposes and is NOT RECOMMENDED for typical use of NORM.NORM's congestion algorithm provides rate adjustment to fairly compete for available network bandwidth with other TCP, NORM, or similarly governed traffic flows.
(TBD - Describe the
NormSetEcnSupport()function as this experimental option matures.)This function enables (or disables) the NORM sender congestion control operation for the session designated by the
sessionHandleparameter. For best operation, this function should be called before the call toNormStartSender()is made, but congestion control operation can be dynamically enabled/disabled during the course of sender operation. If the value of theenableparameter istrue, congestion control operation is enabled while it is disabled for enable equal tofalse. When congestion control operation is enabled, the NORM sender automatically adjusts its transmission rate based on feedback from receivers. If bounds on transmission rate have been set (seeNormSetTxRateBounds()) the rate adjustment will remain within the set bounds. The application will be notified of any changes to the sender transmission rate via aNormEventof typeNORM_TX_RATE_CHANGED.The rate set by
NormSetTxRate()has no effect when congestion control operation is enabled, unless theadjustRateparameter here is set tofalse. When theadjustRateparameter is set tofalse, the NORM Congestion Control operates as usual, with feedback collected from the receiver set and the "current limiting receiver" identified, except that no actual adjustment is made to the sender's transmission rate. I.e., the transmission rate that was set byNormSetTxRate()is observed by the sender regardless of the feedback received. TheNORM_TX_RATE_CHANGEDnotification will still occur as if the rate were being adjusted and the value returned byNormGetTxRate()reflects the rate that would have been used had theadjustRateparameter been enabled even though no actual rate change has occurred. The purpose of this variation of NORM Congestion Control operation is to allow applications to get a "suggested" rate from the NORM-CC mechanism. But, it is important to note that this "suggested" rate may or may not be appropriate since the operation of the NORM-CC algorithm is somewhat dependent on the associated NORM sender load on the network. For example, the "suggested" rate may be artificially high if the sender application has not been correspondingly setting the rate and actively transmitting data at that rate. This optional mode of operation is provided for EXPERIMENTAL purposes and is NOT RECOMMENDED for typical use of NORM.NORM's congestion algorithm provides rate adjustment to fairly compete for available network bandwidth with other TCP, NORM, or similarly governed traffic flows.
(TBD - Describe the
NormSetEcnSupport()function as this experimental option matures.)#include <normApi.h> boolNormSetTxRateBounds(NormSessionHandlesessionHandle, double rateMin, - double rateMax);This function sets the range of sender transmission rates within which the NORM congestion control algorithm is allowed to operate for the given
sessionHandle. By default, the NORM congestion control algorithm operates with no lower or upper bound on its rate adjustment. This function allows this to be limited whererateMincorresponds to the minimum transmission rate (bps) andrateMaxcorresponds to the maximum transmission rate. One or both of these parameters may be set to values less than zero to remove one or both bounds. For example, the call "NormSetTxRateBounds(session, -1.0, 64000.0)" will set an upper limit of 64 kbps for the sender transmission rate with no lower bound. These rate bounds apply only when congestion control operation is enabled (seeNormSetCongestionControl()). If the current congestion control rate falls outside of the specified bounds, the sender transmission rate will be adjusted to stay within the set bounds.This function sets the range of sender transmission rates within which the NORM congestion control algorithm is allowed to operate for the given
sessionHandle. By default, the NORM congestion control algorithm operates with no lower or upper bound on its rate adjustment. This function allows this to be limited whererateMincorresponds to the minimum transmission rate (bps) andrateMaxcorresponds to the maximum transmission rate. One or both of these parameters may be set to values less than zero to remove one or both bounds. For example, the call "NormSetTxRateBounds(session, -1.0, 64000.0)" will set an upper limit of 64 kbps for the sender transmission rate with no lower bound. These rate bounds apply only when congestion control operation is enabled (seeNormSetCongestionControl()). If the current congestion control rate falls outside of the specified bounds, the sender transmission rate will be adjusted to stay within the set bounds.#include <normApi.h> voidNormSetTxCacheBounds(NormSessionHandlesessionHandle,NormSizesizeMax, unsigned int countMin, - unsigned int countMax);This function sets limits that define the number and total size of pending transmit objects a NORM sender will allow to be enqueued by the application. Setting these bounds to large values means the NORM protocol engine will keep history and state for previously transmitted objects for a larger interval of time (depending upon the transmission rate) when the application is actively enqueueing additional objects in response to
NORM_TX_QUEUE_EMPTYnotifications. This can allow more time for receivers suffering degraded network conditions to make repair requests before the sender "purges" older objects from its "transmit cache" when new objects are enqueued. ANORM_TX_OBJECT_PURGEDnotification is issued when the enqueuing of a new transmit object causes the NORM transmit cache to overflow, indicating the NORM sender no longer needs to reference the designated old transmit object and the application is free to release related resources as needed.The
sizeMaxparameter sets the maximum total size, in bytes, of enqueued objects allowed, providing the constraints of thecountMinandcountMaxparameters are met. ThecountMinparameter sets the minimum number of objects the application may enqueue, regardless of the objects' sizes and thesizeMaxvalue. For example, the defaultsizeMaxvalue is 20 Mbyte and the defaultcountMinis 8, thus allowing the application to always have at least 8 pending objects enqueued for transmission if it desires, even if their total size is greater than 20 Mbyte. Similarly, thecountMaxparameter sets a ceiling on how many objects may be enqueued, regardless of their total sizes with respect to thesizeMaxsetting. For example, the defaultcountMaxvalue is 256, which means the application is never allowed to have more than 256 objects pending transmission enqueued, even if they are 256 very small objects. Note thatcountMaxmust be greater than or equal tocountMinandcountMinis recommended to be at least two.Note that in the case of
NORM_OBJECT_FILEobjects, some operating systems impose limits (e.g. 256) on how many open files a process may have at one time and it may be appropriate to limit thecountMaxvalue accordingly. In other cases, a largecountMinorcountMaxmay be desired to allow the NORM sender to act as virtual cache of files or other data available for reliable transmission. Future iterations of the NRL NORM implementation may support alternative NORM receiver "group join" policies that would allow the receivers to request transmission of cached content.The utility of the
NormRequeueObject()API call also depends on the parameters set by this function. TheNormRequeueObject()call will only succeed when the givenobjectHandlecorresponds to an object maintained in the NORM senders "transmit cache".This function sets limits that define the number and total size of pending transmit objects a NORM sender will allow to be enqueued by the application. Setting these bounds to large values means the NORM protocol engine will keep history and state for previously transmitted objects for a larger interval of time (depending upon the transmission rate) when the application is actively enqueueing additional objects in response to
NORM_TX_QUEUE_EMPTYnotifications. This can allow more time for receivers suffering degraded network conditions to make repair requests before the sender "purges" older objects from its "transmit cache" when new objects are enqueued. ANORM_TX_OBJECT_PURGEDnotification is issued when the enqueuing of a new transmit object causes the NORM transmit cache to overflow, indicating the NORM sender no longer needs to reference the designated old transmit object and the application is free to release related resources as needed.The
sizeMaxparameter sets the maximum total size, in bytes, of enqueued objects allowed, providing the constraints of thecountMinandcountMaxparameters are met. ThecountMinparameter sets the minimum number of objects the application may enqueue, regardless of the objects' sizes and thesizeMaxvalue. For example, the defaultsizeMaxvalue is 20 Mbyte and the defaultcountMinis 8, thus allowing the application to always have at least 8 pending objects enqueued for transmission if it desires, even if their total size is greater than 20 Mbyte. Similarly, thecountMaxparameter sets a ceiling on how many objects may be enqueued, regardless of their total sizes with respect to thesizeMaxsetting. For example, the defaultcountMaxvalue is 256, which means the application is never allowed to have more than 256 objects pending transmission enqueued, even if they are 256 very small objects. Note thatcountMaxmust be greater than or equal tocountMinandcountMinis recommended to be at least two.Note that in the case of
NORM_OBJECT_FILEobjects, some operating systems impose limits (e.g. 256) on how many open files a process may have at one time and it may be appropriate to limit thecountMaxvalue accordingly. In other cases, a largecountMinorcountMaxmay be desired to allow the NORM sender to act as virtual cache of files or other data available for reliable transmission. Future iterations of the NRL NORM implementation may support alternative NORM receiver "group join" policies that would allow the receivers to request transmission of cached content.The utility of the
NormRequeueObject()API call also depends on the parameters set by this function. TheNormRequeueObject()call will only succeed when the givenobjectHandlecorresponds to an object maintained in the NORM senders "transmit cache".#include <normApi.h> voidNormSetAutoParity(NormSessionHandlesessionHandle, - unsigned char autoParity);This function sets the quantity of proactive "auto parity"
NORM_DATAmessages sent at the end of each FEC coding block. By default (i.e.,autoParity=0), FEC content is sent only in response to repair requests (NACKs) from receivers. But, by setting a non-zero value forautoParity, the sender can automatically accompany each coding block of transport object source data segments ((NORM_DATAmessages) with the set number of FEC segments. The number of source symbol messages (segments) per FEC coding block is determined by theblockSizeparameter used whenNormStartSender()was called for the givensessionHandle.The use of proactively-sent "auto parity" may eliminate the need for any receiver NACKing to achieve reliable transfer in networks with low packet loss. However, note that the quantity of "auto parity" set adds overhead to transport object transmission. In networks with a predictable level of packet loss and potentially large round-trip times, the use of "auto parity" may allow lower latency in the reliable delivery process. Also, its use may contribute to a smaller amount of receiver feedback as only receivers with exceptional packet loss may need to NACK for additional repair content.
The value of
autoParityset must be less than or equal to thenumParityparameter set whenNormStartSender()was called for the givensessionHandle.This function sets the quantity of proactive "auto parity"
NORM_DATAmessages sent at the end of each FEC coding block. By default (i.e.,autoParity=0), FEC content is sent only in response to repair requests (NACKs) from receivers. But, by setting a non-zero value forautoParity, the sender can automatically accompany each coding block of transport object source data segments ((NORM_DATAmessages) with the set number of FEC segments. The number of source symbol messages (segments) per FEC coding block is determined by theblockSizeparameter used whenNormStartSender()was called for the givensessionHandle.The use of proactively-sent "auto parity" may eliminate the need for any receiver NACKing to achieve reliable transfer in networks with low packet loss. However, note that the quantity of "auto parity" set adds overhead to transport object transmission. In networks with a predictable level of packet loss and potentially large round-trip times, the use of "auto parity" may allow lower latency in the reliable delivery process. Also, its use may contribute to a smaller amount of receiver feedback as only receivers with exceptional packet loss may need to NACK for additional repair content.
The value of
autoParityset must be less than or equal to thenumParityparameter set whenNormStartSender()was called for the givensessionHandle.#include <normApi.h> -doubleNormGetGrttEstimate(NormSessionHandlesessionHandle);This function returns the sender's current estimate(in seconds) of group round-trip timing (GRTT) for the given NORM session. This function may be useful for applications to leverage for other purposes the assessment of round-trip timing made by the NORM protocol engine. For example, an application may scale its own timeouts based on connectivity delays among participants in a NORM session. Note that the
NORM_GRTT_UPDATEDevent is posted (seeNormGetNextEvent()) by the NORM protocol engine to indicate when changes in the local sender or remote senders' GRTT estimate occurs.#include <normApi.h> +doubleNormGetGrttEstimate(NormSessionHandlesessionHandle);This function returns the sender's current estimate(in seconds) of group round-trip timing (GRTT) for the given NORM session. This function may be useful for applications to leverage for other purposes the assessment of round-trip timing made by the NORM protocol engine. For example, an application may scale its own timeouts based on connectivity delays among participants in a NORM session. Note that the
NORM_GRTT_UPDATEDevent is posted (seeNormGetNextEvent()) by the NORM protocol engine to indicate when changes in the local sender or remote senders' GRTT estimate occurs.#include <normApi.h> voidNormSetGrttEstimate(NormSessionHandlesessionHandle, - double grtt);This function sets the sender's estimate of group round-trip time (GRTT) (in units of seconds) for the given NORM
sessionHandle. This function is expected to most typically used to initialize the sender's GRTT estimate prior to the call toNormStartSender()when the application has a priori confidence that the default initial GRTT value of 0.5 second is inappropriate. The sender GRTT estimate will be updated during normal sender protocol operation after sender startup or if this call is made while sender operation is active. For experimental purposes (or very special application needs), this API provides a mechanism to control or disable the sender GRTT update process (seeNormSetGrttProbingMode()). Thegrttvalue (in seconds) will be limited to the maximum GRTT as set (seeNormSetGrttMax()) or the default maximum of 10 seconds.The sender GRTT is advertised to the receiver group and is used to scale various NORM protocol timers. The default NORM GRTT estimation process dynamically measures round-trip timing to determine an appropriate operating value. An overly-large GRTT estimate can introduce additional latency into the reliability process (resulting in a larger virtual delay*bandwidth product for the protocol and potentially requiring more buffer space to maintain reliability). An overly-small GRTT estimate may introduce the potential for feedback implosion, limiting the scalability of group size.
Also note that the advertised GRTT estimate can also be limited by transmission rate. When the sender transmission rate is low, the GRTT is also governed to a lower bound of the nominal packet transmission interval (i.e.,
1/txRate). This maintains the "event driven" nature of the NORM protocol with respect to receiver reception of NORM sender data and commands.This function sets the sender's estimate of group round-trip time (GRTT) (in units of seconds) for the given NORM
sessionHandle. This function is expected to most typically used to initialize the sender's GRTT estimate prior to the call toNormStartSender()when the application has a priori confidence that the default initial GRTT value of 0.5 second is inappropriate. The sender GRTT estimate will be updated during normal sender protocol operation after sender startup or if this call is made while sender operation is active. For experimental purposes (or very special application needs), this API provides a mechanism to control or disable the sender GRTT update process (seeNormSetGrttProbingMode()). Thegrttvalue (in seconds) will be limited to the maximum GRTT as set (seeNormSetGrttMax()) or the default maximum of 10 seconds.The sender GRTT is advertised to the receiver group and is used to scale various NORM protocol timers. The default NORM GRTT estimation process dynamically measures round-trip timing to determine an appropriate operating value. An overly-large GRTT estimate can introduce additional latency into the reliability process (resulting in a larger virtual delay*bandwidth product for the protocol and potentially requiring more buffer space to maintain reliability). An overly-small GRTT estimate may introduce the potential for feedback implosion, limiting the scalability of group size.
Also note that the advertised GRTT estimate can also be limited by transmission rate. When the sender transmission rate is low, the GRTT is also governed to a lower bound of the nominal packet transmission interval (i.e.,
1/txRate). This maintains the "event driven" nature of the NORM protocol with respect to receiver reception of NORM sender data and commands.#include <normApi.h> voidNormSetGrttMax(NormSessionHandlesessionHandle, - double grttMax);This function sets the sender's maximum advertised GRTT value for the given NORM
sessionHandle. ThegrttMaxparameter, in units of seconds, limits the GRTT used by the group for scaling protocol timers, regardless of larger measured round trip times. The default maximum for the NRL NORM library is 10 seconds. See theNormSetGrttEstimate()function description for the purpose of the NORM GRTT measurement process.This function sets the sender's maximum advertised GRTT value for the given NORM
sessionHandle. ThegrttMaxparameter, in units of seconds, limits the GRTT used by the group for scaling protocol timers, regardless of larger measured round trip times. The default maximum for the NRL NORM library is 10 seconds. See theNormSetGrttEstimate()function description for the purpose of the NORM GRTT measurement process.#include <normApi.h> voidNormSetGrttProbingMode(NormSessionHandlesessionHandle, -NormProbingModeprobingMode);This function sets the sender's mode of probing for round trip timing measurement responses from the receiver set for the given NORM
sessionHandle. Possible values for theprobingModeparameter includeNORM_PROBE_NONE,NORM_PROBE_PASSIVE, andNORM_PROBE_ACTIVE. The default probing mode isNORM_PROBE_ACTIVE. In this mode, the receiver set explicitly acknowledges NORM sender GRTT probes ((NORM_Cmessages) withMD(CC)NORM_ACKresponses that are group-wise suppressed. Note that NORM receivers also will include their response to GRTT probing piggy-backed on anyNORM_NACKmessages sent in this mode as well to minimize feedback.Note that the
NORM_PROBE_ACTIVEprobing mode is required and automatically set when NORM congestion control operation is enabled (seeNormSetCongestionControl()). Thus, when congestion control is enabled, theNormSetGrttProbingMode()function has no effect.If congestion control operation is not enabled, the NORM application may elect to reduce the volume of feedback traffic by setting the
probingModetoNORM_PROBE_PASSIVE. Here, the NORM sender still transmitsNORM_CMD(CC)probe messages multiplexed with its data transmission, but the receiver set does not explicitly acknowledge these probes. Instead the receiver set is limited to opportunistically piggy-backing responses whenNORM_NACKmessages are generated. Note that this may, in some cases, introduce some opportunity for bursts of large volume receiver feedback when the sender's estimate of GRTT is incorrect due to the reduced probing feedback. But, in some controlled network environments, this option for passive probing may provide some benefits in reducing protocol overhead.Finally, the
probingModecan be set toNORM_PROBE_NONEto eliminate the overhead (and benefits) of NORM GRTT measurement entirely. In this case, the sender application must explicitly set its estimate of GRTT using theNormSetGrttEstimate()function. See this function for a description of the purpose of the NORM GRTT measurement.#include <normApi.h> +NormProbingModeprobingMode);This function sets the sender's mode of probing for round trip timing measurement responses from the receiver set for the given NORM
sessionHandle. Possible values for theprobingModeparameter includeNORM_PROBE_NONE,NORM_PROBE_PASSIVE, andNORM_PROBE_ACTIVE. The default probing mode isNORM_PROBE_ACTIVE. In this mode, the receiver set explicitly acknowledges NORM sender GRTT probes ((NORM_Cmessages) withMD(CC)NORM_ACKresponses that are group-wise suppressed. Note that NORM receivers also will include their response to GRTT probing piggy-backed on anyNORM_NACKmessages sent in this mode as well to minimize feedback.Note that the
NORM_PROBE_ACTIVEprobing mode is required and automatically set when NORM congestion control operation is enabled (seeNormSetCongestionControl()). Thus, when congestion control is enabled, theNormSetGrttProbingMode()function has no effect.If congestion control operation is not enabled, the NORM application may elect to reduce the volume of feedback traffic by setting the
probingModetoNORM_PROBE_PASSIVE. Here, the NORM sender still transmitsNORM_CMD(CC)probe messages multiplexed with its data transmission, but the receiver set does not explicitly acknowledge these probes. Instead the receiver set is limited to opportunistically piggy-backing responses whenNORM_NACKmessages are generated. Note that this may, in some cases, introduce some opportunity for bursts of large volume receiver feedback when the sender's estimate of GRTT is incorrect due to the reduced probing feedback. But, in some controlled network environments, this option for passive probing may provide some benefits in reducing protocol overhead.Finally, the
probingModecan be set toNORM_PROBE_NONEto eliminate the overhead (and benefits) of NORM GRTT measurement entirely. In this case, the sender application must explicitly set its estimate of GRTT using theNormSetGrttEstimate()function. See this function for a description of the purpose of the NORM GRTT measurement.#include <normApi.h> voidNormSetGrttProbingInterval(NormSessionHandlesessionHandle, double intervalMin, - double intervalMax);This function controls the sender GRTT measurement and estimation process for the given NORM
sessionHandle. The NORM sender multiplexes periodic transmission ofNORM_CMD(CC) messages with its ongoing data transmission or when data transmission is idle. When NORM congestion control operation is enabled, these probes are sent once per RTT of the current limiting receiver (with respect to congestion control rate). In this case theintervalMinandintervalMaxparameters (in units of seconds) control the rate at which the sender's estimate of GRTT is updated. At session start, the estimate is updated atintervalMinand the update interval time is doubled untilintervalMaxis reached. This dynamic allows for a rapid initial estimation of GRTT and a slower, steady-state update of GRTT. When congestion control is disabled and NORM GRTT probing is enabled ((NORM_PROBE_ACTIVEorNORM_PROBE_PASSIVE) theintervalMinandintervalMaxvalues also determine the rate at whichNORM_CMD(CC) probes are transmitted by the sender. Thus by setting larger values forintervalMinandintervalMax, the NORM sender application can reduce the overhead of the GRTT measurement process. However, this also reduces the ability of NORM to adapt to changes in GRTT.The default NORM GRTT
intervalMinandintervalMaxvalues, i.e., when this call is not made, are1.0second and30.0seconds, respectively.This function controls the sender GRTT measurement and estimation process for the given NORM
sessionHandle. The NORM sender multiplexes periodic transmission ofNORM_CMD(CC) messages with its ongoing data transmission or when data transmission is idle. When NORM congestion control operation is enabled, these probes are sent once per RTT of the current limiting receiver (with respect to congestion control rate). In this case theintervalMinandintervalMaxparameters (in units of seconds) control the rate at which the sender's estimate of GRTT is updated. At session start, the estimate is updated atintervalMinand the update interval time is doubled untilintervalMaxis reached. This dynamic allows for a rapid initial estimation of GRTT and a slower, steady-state update of GRTT. When congestion control is disabled and NORM GRTT probing is enabled ((NORM_PROBE_ACTIVEorNORM_PROBE_PASSIVE) theintervalMinandintervalMaxvalues also determine the rate at whichNORM_CMD(CC) probes are transmitted by the sender. Thus by setting larger values forintervalMinandintervalMax, the NORM sender application can reduce the overhead of the GRTT measurement process. However, this also reduces the ability of NORM to adapt to changes in GRTT.The default NORM GRTT
intervalMinandintervalMaxvalues, i.e., when this call is not made, are1.0second and30.0seconds, respectively.#include <normApi.h> voidNormSetBackoffFactor(NormSessionHandlesessionHandle, - double backoffFactor);This function sets the sender's "backoff factor" for the given
sessionHandle. ThebackoffFactor(in units of seconds) is used to scale various timeouts related to the NACK repair process. The sender advertises itsbackoffFactorsetting to the receiver group in NORM protocol message headers. The defaultbackoffFactorfor NORM sessions is4.0seconds. ThebackoffFactoris used to determine the maximum time that receivers may delay NACK transmissions (and other feedback messages) as part of NORM's probabilistic feedback suppression technique. For example, the maximum NACK delay time isbackoffFactor*GRTT. Thus a largebackoffFactorvalue introduces latency into the NORM repair process. However, a small backoffFactor value causes feedback suppression to be less effective and increases the risk of feedback implosion for large receiver group sizes.The default setting of
4.0provides reasonable feedback suppression for moderate to large group sizes when multicast feedback is possible. The NORM specification recommends abackoffFactorvalue of6.0when unicast feedback is used. However, for demanding applications (with respect to repair latency) when group sizes are modest, a small (even0.0)backoffFactorvalue can be specified to reduce the latency of reliable data delivery.This function sets the sender's "backoff factor" for the given
sessionHandle. ThebackoffFactor(in units of seconds) is used to scale various timeouts related to the NACK repair process. The sender advertises itsbackoffFactorsetting to the receiver group in NORM protocol message headers. The defaultbackoffFactorfor NORM sessions is4.0seconds. ThebackoffFactoris used to determine the maximum time that receivers may delay NACK transmissions (and other feedback messages) as part of NORM's probabilistic feedback suppression technique. For example, the maximum NACK delay time isbackoffFactor*GRTT. Thus a largebackoffFactorvalue introduces latency into the NORM repair process. However, a small backoffFactor value causes feedback suppression to be less effective and increases the risk of feedback implosion for large receiver group sizes.The default setting of
4.0provides reasonable feedback suppression for moderate to large group sizes when multicast feedback is possible. The NORM specification recommends abackoffFactorvalue of6.0when unicast feedback is used. However, for demanding applications (with respect to repair latency) when group sizes are modest, a small (even0.0)backoffFactorvalue can be specified to reduce the latency of reliable data delivery.#include <normApi.h> voidNormSetGroupSize(NormSessionHandlesessionHandle, - unsigned int groupSize);This function sets the sender's estimate of receiver group size for the given
sessionHandle. The sender advertises itsgroupSizesetting to the receiver group in NORM protocol message headers that, in turn, use this information to shape the distribution curve of their random timeouts for the timer-based, probabilistic feedback suppression technique used in the NORM protocol. Note that thegroupSizeestimate does not have to be very accurate and values within an order of magnitude of the actual group size tend to produce acceptable performance.The default
groupSizesetting in NORM is1,000and thus can work well for a wide range of actual receiver group sizes. The penalty of an overly large estimate is statistically a little more latency in reliable data delivery with respect to the round trip time and some potential for excess feedback. A substantial underestimation ofgroupSizeincreases the risk of feedback implosion. Currently, the NORM implementation does not attempt to automatically measuregroupSizefrom receiver feedback. Applications could add their own mechanism for this (perhaps keeping explicit track of group membership), or it is possible that future versions of the NRL NORM implementation may have some provision for automaticgroupSizeestimation by the sender based on receiver feedback messages.This function sets the sender's estimate of receiver group size for the given
sessionHandle. The sender advertises itsgroupSizesetting to the receiver group in NORM protocol message headers that, in turn, use this information to shape the distribution curve of their random timeouts for the timer-based, probabilistic feedback suppression technique used in the NORM protocol. Note that thegroupSizeestimate does not have to be very accurate and values within an order of magnitude of the actual group size tend to produce acceptable performance.The default
groupSizesetting in NORM is1,000and thus can work well for a wide range of actual receiver group sizes. The penalty of an overly large estimate is statistically a little more latency in reliable data delivery with respect to the round trip time and some potential for excess feedback. A substantial underestimation ofgroupSizeincreases the risk of feedback implosion. Currently, the NORM implementation does not attempt to automatically measuregroupSizefrom receiver feedback. Applications could add their own mechanism for this (perhaps keeping explicit track of group membership), or it is possible that future versions of the NRL NORM implementation may have some provision for automaticgroupSizeestimation by the sender based on receiver feedback messages.#include <normApi.h> voidNormSetTxRobustFactor(NormSessionHandlesessionHandle, - int txRobustFactor);This routine sets the "robustness factor" used for various NORM sender functions. These functions include the number of repetitions of "robustly-transmitted" NORM sender commands such as
or similar application-defined commands, and the number of attempts that are made to collect positive acknowledgement from receivers. These commands are distinct from the NORM reliable data transmission process, but play a role in overall NORM protocol operation. The defaultNORM_CMD(FLUSH)txRobustFactorvalue is20. This relatively large value makes the NORM sender end-of-transmission flushing and positive acknowledgement collection functions somewhat immune from packet loss. However, for some applications, the default value may make the NORM protocol more "chatty" than desired (particularly if flushing is invoked often). In other situations where the network connectivity may be intermittent or extremely lossy, it may be useful to actually increase this value. The default value (20) is expected to provide reasonable operation across a wide range of network conditions and application types. Since this value is not communicated among NORM participants as part of the protocol operation, it is important that applications consistently set this value among all applications participating in a NORM session.Setting
txRobustFactorto a value of-1makes the redundant transmission of these commands continue indefinitely until completion. For example, with positive acknowledgement collection, the request process will continue indefinitely until all recipients requested acknowledge or the request is canceled by the application. Similarly, flushing commands would be transmitted repeatedly until data transmission is resumed. Typically, settingtxRobustFactorto-1is not recommended.This routine sets the "robustness factor" used for various NORM sender functions. These functions include the number of repetitions of "robustly-transmitted" NORM sender commands such as
or similar application-defined commands, and the number of attempts that are made to collect positive acknowledgement from receivers. These commands are distinct from the NORM reliable data transmission process, but play a role in overall NORM protocol operation. The defaultNORM_CMD(FLUSH)txRobustFactorvalue is20. This relatively large value makes the NORM sender end-of-transmission flushing and positive acknowledgement collection functions somewhat immune from packet loss. However, for some applications, the default value may make the NORM protocol more "chatty" than desired (particularly if flushing is invoked often). In other situations where the network connectivity may be intermittent or extremely lossy, it may be useful to actually increase this value. The default value (20) is expected to provide reasonable operation across a wide range of network conditions and application types. Since this value is not communicated among NORM participants as part of the protocol operation, it is important that applications consistently set this value among all applications participating in a NORM session.Setting
txRobustFactorto a value of-1makes the redundant transmission of these commands continue indefinitely until completion. For example, with positive acknowledgement collection, the request process will continue indefinitely until all recipients requested acknowledge or the request is canceled by the application. Similarly, flushing commands would be transmitted repeatedly until data transmission is resumed. Typically, settingtxRobustFactorto-1is not recommended.#include <normApi.h>NormObjectHandleNormFileEnqueue(NormSessionHandlesessionHandle, const char* filename, const char* infoPtr = NULL, - unsigned int infoLen = 0);This function enqueues a file for transmission within the specified NORM
sessionHandle. Note thatNormStartSender()must have been previously called before files or any transport objects may be enqueued and transmitted. ThefileNameparameter specifies the path to the file to be transmitted. The NORM protocol engine read and writes directly from/to file system storage for file transport, potentially providing for a very large virtual "repair window" as needed for some applications. While relative paths with respect to the "current working directory" may be used, it is recommended that full paths be used when possible. The optionalinfoPtrandinfoLenparameters are used to associateNORM_INFOcontent with the sent transport object. The maximum allowedinfoLencorresponds to thesegmentSizeused in the prior call toNormStartSender(). The use and interpretation of theNORM_INFOcontent is left to the application's discretion. Example usage ofNORM_INFOcontent forNORM_OBJECT_FILEmight include file name, creation date, MIME-type or other information which will enable NORM receivers to properly handle the file when reception is complete.The application is allowed to enqueue multiple transmit objects within in the "transmit cache" bounds (see
NormSetTxCacheBounds()) and enqueued objects are transmitted (and repaired as needed) within the limits determined by automated congestion control (seeNormSetCongestionControl()) or fixed rate (seeNormSetTxRate()) parameters.A
NormObjectHandleis returned which the application may use in other NORM API calls as needed. This handle can be considered valid until the application explicitly cancels the object's transmission (seeNormObjectCancel()) or aNORM_TX_OBJECT_PURGEDevent is received for the given object. Note the application may use theNormObjectRetain()method if it wishes to refer to the object after theNORM_TX_OBJECT_PURGEDnotification. In this case, the application, when finished with the object, must useNormObjectRelease()to free any resources used or else a memory leak condition will result. A value ofNORM_OBJECT_INVALIDis return upon error. Possible failure conditions include the specified session is not operating as a NormSender, insufficient memory resources were available, or the "transmit cache" limits have been reached and all previously enqueued NORM transmit objects are pending transmission. Also the call will fail if theinfoLenparameter exceeds the local NormSendersegmentSizelimit.This function enqueues a file for transmission within the specified NORM
sessionHandle. Note thatNormStartSender()must have been previously called before files or any transport objects may be enqueued and transmitted. ThefileNameparameter specifies the path to the file to be transmitted. The NORM protocol engine read and writes directly from/to file system storage for file transport, potentially providing for a very large virtual "repair window" as needed for some applications. While relative paths with respect to the "current working directory" may be used, it is recommended that full paths be used when possible. The optionalinfoPtrandinfoLenparameters are used to associateNORM_INFOcontent with the sent transport object. The maximum allowedinfoLencorresponds to thesegmentSizeused in the prior call toNormStartSender(). The use and interpretation of theNORM_INFOcontent is left to the application's discretion. Example usage ofNORM_INFOcontent forNORM_OBJECT_FILEmight include file name, creation date, MIME-type or other information which will enable NORM receivers to properly handle the file when reception is complete.The application is allowed to enqueue multiple transmit objects within in the "transmit cache" bounds (see
NormSetTxCacheBounds()) and enqueued objects are transmitted (and repaired as needed) within the limits determined by automated congestion control (seeNormSetCongestionControl()) or fixed rate (seeNormSetTxRate()) parameters.A
NormObjectHandleis returned which the application may use in other NORM API calls as needed. This handle can be considered valid until the application explicitly cancels the object's transmission (seeNormObjectCancel()) or aNORM_TX_OBJECT_PURGEDevent is received for the given object. Note the application may use theNormObjectRetain()method if it wishes to refer to the object after theNORM_TX_OBJECT_PURGEDnotification. In this case, the application, when finished with the object, must useNormObjectRelease()to free any resources used or else a memory leak condition will result. A value ofNORM_OBJECT_INVALIDis return upon error. Possible failure conditions include the specified session is not operating as a NormSender, insufficient memory resources were available, or the "transmit cache" limits have been reached and all previously enqueued NORM transmit objects are pending transmission. Also the call will fail if theinfoLenparameter exceeds the local NormSendersegmentSizelimit.#include <normApi.h>NormObjectHandleNormDataEnqueue(NormSessionHandlesessionHandle, const char* dataPtr, unsigned int dataLen, const char* infoPtr = NULL, - unsigned int infoLen = 0);This function enqueues a segment of application memory space for transmission within the specified NORM
sessionHandle. Note thatNormStartSender()MUST have been previously called before files or any transport objects may be enqueued and transmitted. ThedataPtrparameter must be a valid pointer to the area of application memory to be transmitted and thedataLenparameter indicates the quantity of data to transmit. The NORM protocol engine read and writes directly from/to application memory space so it is important that the application does not modify (or deallocate) the memory space during the time the NORM protocol engine may access this area. After callingNormDataEnqueue()for a specific application "dataPtr" memory space, the application MUST NOT deallocate (or change the contents of) that memory space until aNORM_TX_OBJECT_PURGEDnotification is received for the given object or the application itself explicitly cancels the object's transmission (seeNormObjectCancel()).The optional
infoPtrandinfoLenparameters are used to associateNORM_INFOcontent with the sent transport object. The maximum allowedinfoLencorresponds to thesegmentSizeused in the prior call toNormStartSender(). The use and interpretation of theNORM_INFOcontent is left to the application's discretion. Example usage ofNORM_INFOcontent forNORM_OBJECT_DATAmight include application-defined data typing or other information which will enable NORM receiver applications to properly interpret the received data when reception is complete. Of course, it is possible that the application may embed such typing information in the object data content itself. This is left to the application's discretion.The application is allowed to enqueue multiple transmit objects within in the "transmit cache" bounds (see
NormSetTxCacheBounds()) and enqueued objects are transmitted (and repaired as needed) within the limits determined by automated congestion control (seeNormSetCongestionControl()) or fixed rate (seeNormSetTxRate()) parameters.A
NormObjectHandleis returned which the application may use in other NORM API calls as needed. This handle can be considered valid until the application explicitly cancels the object's transmission (seeNormObjectCancel()) or aNORM_TX_OBJECT_PURGEDevent is received for the given object. Note the application may use theNormObjectRetain()method if it wishes to refer to the object after theNORM_TX_OBJECT_PURGEDnotification. In this case, the application, when finished with the object, must useNormObjectRelease()to free any resources used or else a memory leak condition will result. A value ofNORM_OBJECT_INVALIDis return upon error. Possible failure conditions include the specified session is not operating as a NormSender, insufficient memory resources were available, or the "transmit cache" limits have been reached and all previously enqueued NORM transmit objects are pending transmission. Also the call will fail if theinfoLenparameter exceeds the local NormSendersegmentSizelimit.This function enqueues a segment of application memory space for transmission within the specified NORM
sessionHandle. Note thatNormStartSender()MUST have been previously called before files or any transport objects may be enqueued and transmitted. ThedataPtrparameter must be a valid pointer to the area of application memory to be transmitted and thedataLenparameter indicates the quantity of data to transmit. The NORM protocol engine read and writes directly from/to application memory space so it is important that the application does not modify (or deallocate) the memory space during the time the NORM protocol engine may access this area. After callingNormDataEnqueue()for a specific application "dataPtr" memory space, the application MUST NOT deallocate (or change the contents of) that memory space until aNORM_TX_OBJECT_PURGEDnotification is received for the given object or the application itself explicitly cancels the object's transmission (seeNormObjectCancel()).The optional
infoPtrandinfoLenparameters are used to associateNORM_INFOcontent with the sent transport object. The maximum allowedinfoLencorresponds to thesegmentSizeused in the prior call toNormStartSender(). The use and interpretation of theNORM_INFOcontent is left to the application's discretion. Example usage ofNORM_INFOcontent forNORM_OBJECT_DATAmight include application-defined data typing or other information which will enable NORM receiver applications to properly interpret the received data when reception is complete. Of course, it is possible that the application may embed such typing information in the object data content itself. This is left to the application's discretion.The application is allowed to enqueue multiple transmit objects within in the "transmit cache" bounds (see
NormSetTxCacheBounds()) and enqueued objects are transmitted (and repaired as needed) within the limits determined by automated congestion control (seeNormSetCongestionControl()) or fixed rate (seeNormSetTxRate()) parameters.A
NormObjectHandleis returned which the application may use in other NORM API calls as needed. This handle can be considered valid until the application explicitly cancels the object's transmission (seeNormObjectCancel()) or aNORM_TX_OBJECT_PURGEDevent is received for the given object. Note the application may use theNormObjectRetain()method if it wishes to refer to the object after theNORM_TX_OBJECT_PURGEDnotification. In this case, the application, when finished with the object, must useNormObjectRelease()to free any resources used or else a memory leak condition will result. A value ofNORM_OBJECT_INVALIDis return upon error. Possible failure conditions include the specified session is not operating as a NormSender, insufficient memory resources were available, or the "transmit cache" limits have been reached and all previously enqueued NORM transmit objects are pending transmission. Also the call will fail if theinfoLenparameter exceeds the local NormSendersegmentSizelimit.#include <normApi.h> boolNormRequeueObject(NormSessionHandlesessionHandle, -NormObjectHandleobjectHandle);This function allows the application to resend (or reset transmission of) a
NORM_OBJECT_FILEorNORM_OBJECT_DATAtransmit object that was previously enqueued for the indicatedsessionHandle. This function is useful for applications sending to silent (non-NACKing) receivers as it enables the receivers to take advantage of multiple retransmissions of objects (including any auto-parity set, seeNormSetAutoParity()) to more robustly receive content. TheobjectHandleparameter must be a valid transmitNormObjectHandlethat has not yet been "purged" from the sender's transmit queue. Upon success, the specified object will be fully retransmitted using the same NORM object transport identifier as was used on its initial transmission. This call may be made at any time to restart transmission of a previously-enqueued object, but theNORM_TX_OBJECT_SENTorNORM_TX_FLUSH_COMPLETEDnotifications can serve as good cues for an appropriate time to resend an object. If multiple objects are re-queued, they will be resent in order of their initial enqueueing.The transmit cache bounds set by
NormSetTxCacheBounds()determine the number of previously-sent objects retained in the sender's transmit queue and that are thus eligible to be requeued for retransmission. An object may be requeued via this call multiple times, but each distinct requeue should be done after an indication such asNORM_TX_OBJECT_SENTorNORM_TX_FLUSH_COMPLETEDfor the given object. Otherwise, the object will simply be reset from its current transmission point to transmit from the beginning (i.e. restart). Note that the object typeNORM_OBJECT_STREAMcannot currently be requeued.(TBD - should a "numRepeats" parameter be added to this function?)
A value of
trueis returned upon success and a value offalseis returned upon failure. Possible reasons for failure include an invalidobjectHandlewas provided (i.e. a non-transmit object or transmit object that has been "purged" from the transmit queue (seeNORM_TX_OBJECT_PURGED)) or the provided object was of typeNORM_OBJECT_STREAM.#include <normApi.h> +NormObjectHandleobjectHandle);This function allows the application to resend (or reset transmission of) a
NORM_OBJECT_FILEorNORM_OBJECT_DATAtransmit object that was previously enqueued for the indicatedsessionHandle. This function is useful for applications sending to silent (non-NACKing) receivers as it enables the receivers to take advantage of multiple retransmissions of objects (including any auto-parity set, seeNormSetAutoParity()) to more robustly receive content. TheobjectHandleparameter must be a valid transmitNormObjectHandlethat has not yet been "purged" from the sender's transmit queue. Upon success, the specified object will be fully retransmitted using the same NORM object transport identifier as was used on its initial transmission. This call may be made at any time to restart transmission of a previously-enqueued object, but theNORM_TX_OBJECT_SENTorNORM_TX_FLUSH_COMPLETEDnotifications can serve as good cues for an appropriate time to resend an object. If multiple objects are re-queued, they will be resent in order of their initial enqueueing.The transmit cache bounds set by
NormSetTxCacheBounds()determine the number of previously-sent objects retained in the sender's transmit queue and that are thus eligible to be requeued for retransmission. An object may be requeued via this call multiple times, but each distinct requeue should be done after an indication such asNORM_TX_OBJECT_SENTorNORM_TX_FLUSH_COMPLETEDfor the given object. Otherwise, the object will simply be reset from its current transmission point to transmit from the beginning (i.e. restart). Note that the object typeNORM_OBJECT_STREAMcannot currently be requeued.(TBD - should a "numRepeats" parameter be added to this function?)
A value of
trueis returned upon success and a value offalseis returned upon failure. Possible reasons for failure include an invalidobjectHandlewas provided (i.e. a non-transmit object or transmit object that has been "purged" from the transmit queue (seeNORM_TX_OBJECT_PURGED)) or the provided object was of typeNORM_OBJECT_STREAM.#include <normApi.h>NormObjectHandleNormStreamOpen(NormSessionHandlesessionHandle, unsigned int bufferSize, const char* infoPtr = NULL, - unsigned int infoLen = 0);This function opens a
NORM_OBJECT_STREAMsender object and enqueues it for transmission within the indicatedsessionHandle. NORM streams provide reliable, in-order delivery of data content written to the stream by the sender application. Note that no data is sent until subsequent calls toNormStreamWrite()are made unlessNORM_INFOcontent is specified for the stream with theinfoPtrandinfoLenparameters. Example usage ofNORM_INFOcontent forNORM_OBJECT_STREAMmight include application-defined data typing or other information which will enable NORM receiver applications to properly interpret the received stream as it is being received. The NORM protocol engine buffers data written to the stream for original transmission and repair transmissions as needed to achieve reliable transfer. ThebufferSizeparameter controls the size of the stream's "repair window" which limits how far back the sender will "rewind" to satisfy receiver repair requests.NORM, as a NACK-oriented protocol, currently lacks a mechanism for receivers to explicitly feedback flow control status to the sender unless the sender application specifically leverages NORM's optional positive-acknowledgement (ACK) features. Thus, the
bufferSizeselection plays an important role in reliable delivery of NORM stream content. Generally, a largerbufferSizevalue is safer with respect to reliability, but some applications may wish to limit how far the sender rewinds to repair receivers with poor connectivity with respect to the group at large. Such applications may set a smallerbufferSizeto avoid the potential for large latency in data delivery (i.e. favor peak delivery latency over full reliability). This may result in breaks in the reliable delivery of stream data to some receivers, but this form of quasi-reliability while limiting latency may be useful for some types of applications (e.g. reliable real-time messaging, video or sensor or media data transport). Note that NORM receivers can quickly, automatically "resync" to the sender after such breaks if the application leverages the application message boundary recovery features of NORM (seeNormStreamMarkEom()).Note that the current implementation of NORM is designed to support only one active stream per session, and that any
NORM_OBJECT_DATAorNORM_OBJECT_FILEobjects enqueued for transmission will not begin transmission until an active stream is closed. Applications requiring multiple streams or concurrent file/data transfer SHOULD generally instantiate multiple NormSessions as needed.Note there is no corresponding "open" call for receiver streams. Receiver
NORM_OBJECT_STREAMsare automatically opened by the NORM protocol engine and the receiver applications is notified of new streams via theNORM_RX_OBJECT_NEWnotification (seeNormGetNextEvent()).A
NormObjectHandleis returned which the application may use in other NORM API calls as needed. This handle can be considered valid until the application explicitly cancels the object's transmission (seeNormObjectCancel()) or aNORM_TX_OBJECT_PURGEDevent is received for the given object. Note the application may use theNormObjectRetain()method if it wishes to refer to the object after theNORM_TX_OBJECT_PURGEDnotification. In this case, the application, when finished with the object, must useNormObjectRelease()to free any resources used or else a memory leak condition will result. A value ofNORM_OBJECT_INVALIDis return upon error. Possible failure conditions include the specified session is not operating as a NormSender, insufficient memory resources were available, or the "transmit cache" bounds have been reached and all previously enqueued NORM transmit objects are pending transmission. Also the call will fail if theinfoLenparameter exceeds the local NormSendersegmentSizelimit.This function opens a
NORM_OBJECT_STREAMsender object and enqueues it for transmission within the indicatedsessionHandle. NORM streams provide reliable, in-order delivery of data content written to the stream by the sender application. Note that no data is sent until subsequent calls toNormStreamWrite()are made unlessNORM_INFOcontent is specified for the stream with theinfoPtrandinfoLenparameters. Example usage ofNORM_INFOcontent forNORM_OBJECT_STREAMmight include application-defined data typing or other information which will enable NORM receiver applications to properly interpret the received stream as it is being received. The NORM protocol engine buffers data written to the stream for original transmission and repair transmissions as needed to achieve reliable transfer. ThebufferSizeparameter controls the size of the stream's "repair window" which limits how far back the sender will "rewind" to satisfy receiver repair requests.NORM, as a NACK-oriented protocol, currently lacks a mechanism for receivers to explicitly feedback flow control status to the sender unless the sender application specifically leverages NORM's optional positive-acknowledgement (ACK) features. Thus, the
bufferSizeselection plays an important role in reliable delivery of NORM stream content. Generally, a largerbufferSizevalue is safer with respect to reliability, but some applications may wish to limit how far the sender rewinds to repair receivers with poor connectivity with respect to the group at large. Such applications may set a smallerbufferSizeto avoid the potential for large latency in data delivery (i.e. favor peak delivery latency over full reliability). This may result in breaks in the reliable delivery of stream data to some receivers, but this form of quasi-reliability while limiting latency may be useful for some types of applications (e.g. reliable real-time messaging, video or sensor or media data transport). Note that NORM receivers can quickly, automatically "resync" to the sender after such breaks if the application leverages the application message boundary recovery features of NORM (seeNormStreamMarkEom()).Note that the current implementation of NORM is designed to support only one active stream per session, and that any
NORM_OBJECT_DATAorNORM_OBJECT_FILEobjects enqueued for transmission will not begin transmission until an active stream is closed. Applications requiring multiple streams or concurrent file/data transfer SHOULD generally instantiate multiple NormSessions as needed.Note there is no corresponding "open" call for receiver streams. Receiver
NORM_OBJECT_STREAMsare automatically opened by the NORM protocol engine and the receiver applications is notified of new streams via theNORM_RX_OBJECT_NEWnotification (seeNormGetNextEvent()).A
NormObjectHandleis returned which the application may use in other NORM API calls as needed. This handle can be considered valid until the application explicitly cancels the object's transmission (seeNormObjectCancel()) or aNORM_TX_OBJECT_PURGEDevent is received for the given object. Note the application may use theNormObjectRetain()method if it wishes to refer to the object after theNORM_TX_OBJECT_PURGEDnotification. In this case, the application, when finished with the object, must useNormObjectRelease()to free any resources used or else a memory leak condition will result. A value ofNORM_OBJECT_INVALIDis return upon error. Possible failure conditions include the specified session is not operating as a NormSender, insufficient memory resources were available, or the "transmit cache" bounds have been reached and all previously enqueued NORM transmit objects are pending transmission. Also the call will fail if theinfoLenparameter exceeds the local NormSendersegmentSizelimit.#include <normApi.h> voidNormStreamClose(NormObjectHandlestreamHandle, - bool graceful = false);This function halts transfer of the stream specified by the
streamHandleparameter and releases any resources used unless the associated object has been explicitly retained by a call toNormObjectRetain(). No further calls toNormStreamWrite()will be successful for the givenstreamHandle. The optional graceful parameter, when set to a value of true, may be used by NORM senders to initiate "graceful" shutdown of a transmit stream. In this case, the sender application will be notified that stream has (most likely) completed reliable transfer via theNORM_TX_OBJECT_PURGEDnotification upon completion of the graceful shutdown process. When thegracefuloption is set totrue, receivers are notified of the stream end via an "stream end" stream control code inNORM_DATAmessage and will receive aNORM_RX_OBJECT_COMPLETEDnotification after all received stream content has been read. Otherwise, the stream is immediately terminated, regardless of receiver state. In this case, this function is equivalent to theNormObjectCancel()routine and may be used for sender or receiver streams. So, it is expected this function (NormStreamClose()) will typically be used for transmit streams by NORM senders.This function halts transfer of the stream specified by the
streamHandleparameter and releases any resources used unless the associated object has been explicitly retained by a call toNormObjectRetain(). No further calls toNormStreamWrite()will be successful for the givenstreamHandle. The optional graceful parameter, when set to a value of true, may be used by NORM senders to initiate "graceful" shutdown of a transmit stream. In this case, the sender application will be notified that stream has (most likely) completed reliable transfer via theNORM_TX_OBJECT_PURGEDnotification upon completion of the graceful shutdown process. When thegracefuloption is set totrue, receivers are notified of the stream end via an "stream end" stream control code inNORM_DATAmessage and will receive aNORM_RX_OBJECT_COMPLETEDnotification after all received stream content has been read. Otherwise, the stream is immediately terminated, regardless of receiver state. In this case, this function is equivalent to theNormObjectCancel()routine and may be used for sender or receiver streams. So, it is expected this function (NormStreamClose()) will typically be used for transmit streams by NORM senders.#include <normApi.h> unsigned intNormStreamWrite(NormObjectHandlestreamHandle const char* buffer, - unsigned int numBytes);This function enqueues data for transmission within the NORM stream specified by the
streamHandleparameter. Thebufferparameter must be a pointer to the data to be enqueued and thenumBytesparameter indicates the length of the data content. Note this call does not block and will return immediately. The return value indicates the number of bytes copied from the provided buffer to the internal stream transmission buffers. Calls to this function will be successful unless the stream's transmit buffer space is fully occupied with data pending original or repair transmission if the stream's "push mode" is set to false (default, seeNormStreamSetPushEnable()for details). If the stream's "push mode" is set to true, a call toNormStreamWrite()will always result in copying of application data to the stream at the cost of previously enqueued data pending transmission (original or repair) being dropped by the NORM protocol engine. While NORM NACK-based reliability does not provide explicit flow control, there is some degree of implicit flow control in limiting writing new data to the stream against pending repairs. Other flow control strategies are possible using theNormSetWatermark()function.NormSetWatermark()function.The
NormEventvaluesNORM_TX_QUEUE_EMPTYandNORM_TX_QUEUE_VACANCYare posted with theNormEvent::objectfield set to a valid sender streamNormObjectHandleto indicate when the stream is ready for writing via this function. Note that theNORM_TX_QUEUE_VACANCYevent type is posted only after the stream's transmit buffer has been completely filled. Thus, the application must make a call toNormStreamWrite()that copies less than the requestednumBytesvalue (return value less thannumBytes) before additionalNORM_TX_QUEUE_VACANCYevents are posted for the givenstreamHandle(i.e., the event type is not re-posted until the application has again filled the available stream transmit buffer space). By cueing off ofNORM_TX_QUEUE_EMPTY, the application can write its "freshest" available data to the stream, but by cueing off ofNORM_TX_QUEUE_VACANCY, an application can keep the NORM protocol engine busiest, to achieve the maximum possible throughput at high data rates.This function enqueues data for transmission within the NORM stream specified by the
streamHandleparameter. Thebufferparameter must be a pointer to the data to be enqueued and thenumBytesparameter indicates the length of the data content. Note this call does not block and will return immediately. The return value indicates the number of bytes copied from the provided buffer to the internal stream transmission buffers. Calls to this function will be successful unless the stream's transmit buffer space is fully occupied with data pending original or repair transmission if the stream's "push mode" is set to false (default, seeNormStreamSetPushEnable()for details). If the stream's "push mode" is set to true, a call toNormStreamWrite()will always result in copying of application data to the stream at the cost of previously enqueued data pending transmission (original or repair) being dropped by the NORM protocol engine. While NORM NACK-based reliability does not provide explicit flow control, there is some degree of implicit flow control in limiting writing new data to the stream against pending repairs. Other flow control strategies are possible using theNormSetWatermark()function.NormSetWatermark()function.The
NormEventvaluesNORM_TX_QUEUE_EMPTYandNORM_TX_QUEUE_VACANCYare posted with theNormEvent::objectfield set to a valid sender streamNormObjectHandleto indicate when the stream is ready for writing via this function. Note that theNORM_TX_QUEUE_VACANCYevent type is posted only after the stream's transmit buffer has been completely filled. Thus, the application must make a call toNormStreamWrite()that copies less than the requestednumBytesvalue (return value less thannumBytes) before additionalNORM_TX_QUEUE_VACANCYevents are posted for the givenstreamHandle(i.e., the event type is not re-posted until the application has again filled the available stream transmit buffer space). By cueing off ofNORM_TX_QUEUE_EMPTY, the application can write its "freshest" available data to the stream, but by cueing off ofNORM_TX_QUEUE_VACANCY, an application can keep the NORM protocol engine busiest, to achieve the maximum possible throughput at high data rates.#include <normApi.h> voidNormStreamFlush(NormObjectHandlestreamHandle, bool eom = false, -NormFlushModeflushMode =NORM_FLUSH_PASSIVE);This function causes an immediate "flush" of the transmit stream specified by the
streamHandleparameter. Normally, unlessNormStreamSetAutoFlush()has been invoked, the NORM protocol engine buffers data written to a stream until it has accumulated a sufficient quantity to generate aNORM_DATAmessage with a full payload (as designated by thesegmentSizeparameter of theNormStartSender()call). This results in most efficient operation with respect to protocol overhead. However, for some NORM streams, the application may not wish wait for such accumulation when critical data has been written to a stream. The default stream "flush" operation invoked viaNormStreamFlush()forflushModeequal toNORM_FLUSH_PASSIVEcauses NORM to immediately transmit all enqueued data for the stream (subject to session transmit rate limits), even if this results inNORM_DATAmessages with "small" payloads. If the optionalflushModeparameter is set toNORM_FLUSH_ACTIVE, the application can achieve reliable delivery of stream content up to the current write position in an even more proactive fashion. In this case, the sender additionally, actively transmitsNORM_CMD(FLUSH) messages after any enqueued stream content has been sent. This immediately prompt receivers for repair requests which reduces latency of reliable delivery, but at a cost of some additional messaging. Note any such "active" flush activity will be terminated upon the next subsequent write to the stream. IfflushModeis set toNORM_FLUSH_NONE, this call has no effect other than the optional end-of-message marking described here.The optional
eomparameter, when set totrue, allows the sender application to mark an end-of-message indication (seeNormStreamMarkEom()) for the stream and initiate flushing in a single function call. The end-of-message indication causes NORM to embed the appropriate message start byte offset in theNORM_DATAmessage generated following a subsequent write to the stream with theNORM_FLAGS_MSG_STARTflag. This mechanism provide a means for automatic application message boundary recovery when receivers join or re-sync to a sender mid-stream.Note that frequent flushing, particularly for
NORM_FLUSH_ACTIVEoperation, may result in more NORM protocol activity than usual, so care must be taken in application design and deployment when scalability to large group sizes is expected.#include <normApi.h> +NormFlushModeflushMode =NORM_FLUSH_PASSIVE);This function causes an immediate "flush" of the transmit stream specified by the
streamHandleparameter. Normally, unlessNormStreamSetAutoFlush()has been invoked, the NORM protocol engine buffers data written to a stream until it has accumulated a sufficient quantity to generate aNORM_DATAmessage with a full payload (as designated by thesegmentSizeparameter of theNormStartSender()call). This results in most efficient operation with respect to protocol overhead. However, for some NORM streams, the application may not wish wait for such accumulation when critical data has been written to a stream. The default stream "flush" operation invoked viaNormStreamFlush()forflushModeequal toNORM_FLUSH_PASSIVEcauses NORM to immediately transmit all enqueued data for the stream (subject to session transmit rate limits), even if this results inNORM_DATAmessages with "small" payloads. If the optionalflushModeparameter is set toNORM_FLUSH_ACTIVE, the application can achieve reliable delivery of stream content up to the current write position in an even more proactive fashion. In this case, the sender additionally, actively transmitsNORM_CMD(FLUSH) messages after any enqueued stream content has been sent. This immediately prompt receivers for repair requests which reduces latency of reliable delivery, but at a cost of some additional messaging. Note any such "active" flush activity will be terminated upon the next subsequent write to the stream. IfflushModeis set toNORM_FLUSH_NONE, this call has no effect other than the optional end-of-message marking described here.The optional
eomparameter, when set totrue, allows the sender application to mark an end-of-message indication (seeNormStreamMarkEom()) for the stream and initiate flushing in a single function call. The end-of-message indication causes NORM to embed the appropriate message start byte offset in theNORM_DATAmessage generated following a subsequent write to the stream with theNORM_FLAGS_MSG_STARTflag. This mechanism provide a means for automatic application message boundary recovery when receivers join or re-sync to a sender mid-stream.Note that frequent flushing, particularly for
NORM_FLUSH_ACTIVEoperation, may result in more NORM protocol activity than usual, so care must be taken in application design and deployment when scalability to large group sizes is expected.#include <normApi.h> voidNormStreamSetAutoFlush(NormObjectHandlestreamHandle -NormFlushModeflushMode);This function sets "automated flushing" for the NORM transmit stream indicated by the
streamHandleparameter. By default, a NORM transmit stream is "flushed" only when explicitly requested by the application (seeNormStreamFlush()). However, to simplify programming, the NORM API allows that automated flushing be enabled such that the "flush" operation occurs every time the full requested buffer provided to aNormStreamWrite()call is successfully enqueued. This may be appropriate for messaging applications where the provided buffers corresponds to an application messages requiring immediate, full transmission. This may make the NORM protocol perhaps more "chatty" than its typical "bulk transfer" form of operation, but can provide a useful capability for some applications.Possible values for the
flushModeparameter includeNORM_FLUSH_NONE,NORM_FLUSH_PASSIVE, andNORM_FLUSH_ACTIVE. The default setting for a NORM stream isNORM_FLUSH_NONEwhere no flushing occurs unless explicitly requested viaNormStreamFlush(). By setting the automatedflushModetoNORM_FLUSH_PASSIVE, the only action taken is to immediately transmit any data that has been written to the stream, even if "runt"NORM_DATAmessages (with payloads less than the NormSendersegmentSizeparameter) are generated as a result. IfNORM_FLUSH_ACTIVEis specified, the automated flushing operation is further augmented with the additional transmission ofNORM_Cmessages to proactively excite the receiver group for repair requests.MD(FLUSH)#include <normApi.h> +NormFlushModeflushMode);This function sets "automated flushing" for the NORM transmit stream indicated by the
streamHandleparameter. By default, a NORM transmit stream is "flushed" only when explicitly requested by the application (seeNormStreamFlush()). However, to simplify programming, the NORM API allows that automated flushing be enabled such that the "flush" operation occurs every time the full requested buffer provided to aNormStreamWrite()call is successfully enqueued. This may be appropriate for messaging applications where the provided buffers corresponds to an application messages requiring immediate, full transmission. This may make the NORM protocol perhaps more "chatty" than its typical "bulk transfer" form of operation, but can provide a useful capability for some applications.Possible values for the
flushModeparameter includeNORM_FLUSH_NONE,NORM_FLUSH_PASSIVE, andNORM_FLUSH_ACTIVE. The default setting for a NORM stream isNORM_FLUSH_NONEwhere no flushing occurs unless explicitly requested viaNormStreamFlush(). By setting the automatedflushModetoNORM_FLUSH_PASSIVE, the only action taken is to immediately transmit any data that has been written to the stream, even if "runt"NORM_DATAmessages (with payloads less than the NormSendersegmentSizeparameter) are generated as a result. IfNORM_FLUSH_ACTIVEis specified, the automated flushing operation is further augmented with the additional transmission ofNORM_Cmessages to proactively excite the receiver group for repair requests.MD(FLUSH)#include <normApi.h> voidNormStreamSetPushEnable(NormObjectHandlestreamHandle, - bool pushEnable);This function controls how the NORM API behaves when the application attempts to enqueue new stream data for transmission when the associated stream's transmit buffer is fully occupied with data pending original or repair transmission. By default (
pushEnable=false), a call toNormStreamWrite()will return a zero value under this condition, indicating it was unable to enqueue the new data. However, ifpushEnableis set totruefor a givenstreamHandle, the NORM protocol engine will discard the oldest buffered stream data (even if it is pending repair transmission or has never been transmitted) as needed to enqueue the new data. Thus a call toNormStreamWrite()will never fail to copy data. This behavior may be desirable for applications where it is more important to quickly delivery new data than to reliably deliver older data written to a stream. The default behavior for a newly opened stream corresponds topushEnableequalsfalse. This limits the rate to which an application can write new data to the stream to the current transmission rate and status of the reliable repair process.This function controls how the NORM API behaves when the application attempts to enqueue new stream data for transmission when the associated stream's transmit buffer is fully occupied with data pending original or repair transmission. By default (
pushEnable=false), a call toNormStreamWrite()will return a zero value under this condition, indicating it was unable to enqueue the new data. However, ifpushEnableis set totruefor a givenstreamHandle, the NORM protocol engine will discard the oldest buffered stream data (even if it is pending repair transmission or has never been transmitted) as needed to enqueue the new data. Thus a call toNormStreamWrite()will never fail to copy data. This behavior may be desirable for applications where it is more important to quickly delivery new data than to reliably deliver older data written to a stream. The default behavior for a newly opened stream corresponds topushEnableequalsfalse. This limits the rate to which an application can write new data to the stream to the current transmission rate and status of the reliable repair process.#include <normApi.h> -boolNormStreamHasVacancy(NormObjectHandlestreamHandle);This function can be used to query whether the transmit stream, specified by the
streamHandleparameter, has buffer space available so that the application may successfully make a call toNormStreamWrite(). Normally, a call toNormStreamWrite()itself can be used to make this determination, but this function can be useful when "push mode" has been enabled (see the description of theNormStreamSetPushEnable()function) and the application wants to avoid overwriting data previously written to the stream that has not yet been transmitted. Note that when "push mode" is enabled, a call toNormStreamWrite()will always succeed, overwriting previously-enqueued data if necessary. Normally, this function will return true after aNORM_TX_QUEUE_VACANCYnotification has been received for a given NORM stream object.#include <normApi.h> +boolNormStreamHasVacancy(NormObjectHandlestreamHandle);This function can be used to query whether the transmit stream, specified by the
streamHandleparameter, has buffer space available so that the application may successfully make a call toNormStreamWrite(). Normally, a call toNormStreamWrite()itself can be used to make this determination, but this function can be useful when "push mode" has been enabled (see the description of theNormStreamSetPushEnable()function) and the application wants to avoid overwriting data previously written to the stream that has not yet been transmitted. Note that when "push mode" is enabled, a call toNormStreamWrite()will always succeed, overwriting previously-enqueued data if necessary. Normally, this function will return true after aNORM_TX_QUEUE_VACANCYnotification has been received for a given NORM stream object.#include <normApi.h> -voidNormStreamMarkEom(NormObjectHandlestreamHandle);This function allows the application to indicate to the NORM protocol engine that the last data successfully written to the stream indicated by
streamHandlecorresponded to the end of an application-defined message boundary. The end-of-message indication given here will cause the NORM protocol engine to embed the appropriate message start byte offset in theNORM_DATAmessage generated that contains the data for the subsequent application call to NormStreamWrite(). Use of this end-of-message marking enables NORM receivers to automatically re-sync to application-defined message boundaries when joining (or re-joining) a NORM session already in progress.#include <normApi.h> +voidNormStreamMarkEom(NormObjectHandlestreamHandle);This function allows the application to indicate to the NORM protocol engine that the last data successfully written to the stream indicated by
streamHandlecorresponded to the end of an application-defined message boundary. The end-of-message indication given here will cause the NORM protocol engine to embed the appropriate message start byte offset in theNORM_DATAmessage generated that contains the data for the subsequent application call to NormStreamWrite(). Use of this end-of-message marking enables NORM receivers to automatically re-sync to application-defined message boundaries when joining (or re-joining) a NORM session already in progress.#include <normApi.h> boolNormSetWatermark(NormSessionHandlesessionHandle,NormObjectHandleobjectHandle, - bool overrideFlush = true);This function specifies a "watermark" transmission point at which NORM sender protocol operation should perform a flushing process and/or positive acknowledgment collection for a given
sessionHandle. ForNORM_OBJECT_FILEandNORM_OBJECT_DATAtransmissions, the positive acknowledgement collection will begin when the specified object has been completely transmitted. TheobjectHandleparameter must be a valid handle to a previously-created sender object (seeNormFileEnqueue(),NormDataEnqueue(), orNormStreamOpen()). ForNORM_OBJECT_STREAMtransmission, the positive acknowledgment collection begins immediately, using the current position (offset of most recent data written) of the sender stream as a reference.The functions
NormAddAckingNode()andNormRemoveAckingNode()are used to manage the list ofNormNodeIdvalues corresponding to NORM receivers that are expected to explicitly acknowledge the watermark flushing messages transmitted by the sender. Note that theNormNodeIdNORM_NODE_NONEmay be included in the list. Inclusion ofNORM_NODE_NONEforces the watermark flushing process to proceed through a fullNORM_ROBUST_FACTORnumber of rounds before completing, prompting any receivers that have not completed reliable reception to the given watermark point to NACK for any repair needs. If NACKs occur, the flushing process is reset and repeated until completing with no NACKs for data through the given watermark transmission point are received. Thus, even without explicit positive acknowledgment, the sender can use this process (by addingNORM_NODE_NONEto the session's list of "acking nodes") for a high level of assurance that the receiver set is "happy" (completed reliable data reception) through the given object (or stream transmission point).The event
NORM_TX_WATERMARK_COMPLETEDis posted for the given session when the flushing process or positive acknowledgment collection has completed. The process completes as soon as all listed receivers have responded unlessNORM_NODE_NONEis included in the "acking node" list. The sender application may use the functionNormGetAckingStatus()to determine the degree of success of the flushing process in general or for individualNormNodeIdvalues.The flushing is conducted concurrently with ongoing data transmission and does not impede the progress of reliable data transfer. Thus the sender may still enqueue NormObjects for transmission (or write to the existing stream) and the positive acknowledgement collection and flushing procedure will be multiplexed with the ongoing data transmission. However, the sender application may wish to defer from or limit itself in sending more data until a
NORM_TX_WATERMARK_COMPLETEDevent is received for the given session. This provides a form of sender->receiver(s) flow control which does not exist in NORM's default protocol operation. If a subsequent call is made toNormSetWatermark()before the current acknowledgement request has completed, the pending acknowledgment request is canceled and the new one begins.The optional
overrideFlushparameter, when set totrue, causes the watermark acknowledgment process that is established with this function call to potentially fully supersede the usual NORM end-of-transmission flushing process that occurs. IfoverrideFlushis set and the "watermark" transmission point corresponds to the last transmission that will result from data enqueued by the sending application, then the watermark flush completion will terminate the usual flushing process. I.e., if positive acknowledgement of watermark is received from the full "acking node list", then no further flushing is conducted. Thus, theoverrideFlushparameter should only be set when the "acking node list" contains a complete list of intended recipients. This is useful for small receiver groups (or unicast operation) to reduce the "chattiness" of NORM's default end-of-transmission flush process. Note that once the watermark flush is completed and further data enqueued and transmitted, the normal default end-of-transmission behavior will be resumed unless another "watermark" is set withoverrideFlushenabled. Thus, as long as new watermarks are established by successive use of this API call, this effectively "morphs" NORM into a protocol driven by positive acknowledgement behavior.This function specifies a "watermark" transmission point at which NORM sender protocol operation should perform a flushing process and/or positive acknowledgment collection for a given
sessionHandle. ForNORM_OBJECT_FILEandNORM_OBJECT_DATAtransmissions, the positive acknowledgement collection will begin when the specified object has been completely transmitted. TheobjectHandleparameter must be a valid handle to a previously-created sender object (seeNormFileEnqueue(),NormDataEnqueue(), orNormStreamOpen()). ForNORM_OBJECT_STREAMtransmission, the positive acknowledgment collection begins immediately, using the current position (offset of most recent data written) of the sender stream as a reference.The functions
NormAddAckingNode()andNormRemoveAckingNode()are used to manage the list ofNormNodeIdvalues corresponding to NORM receivers that are expected to explicitly acknowledge the watermark flushing messages transmitted by the sender. Note that theNormNodeIdNORM_NODE_NONEmay be included in the list. Inclusion ofNORM_NODE_NONEforces the watermark flushing process to proceed through a fullNORM_ROBUST_FACTORnumber of rounds before completing, prompting any receivers that have not completed reliable reception to the given watermark point to NACK for any repair needs. If NACKs occur, the flushing process is reset and repeated until completing with no NACKs for data through the given watermark transmission point are received. Thus, even without explicit positive acknowledgment, the sender can use this process (by addingNORM_NODE_NONEto the session's list of "acking nodes") for a high level of assurance that the receiver set is "happy" (completed reliable data reception) through the given object (or stream transmission point).The event
NORM_TX_WATERMARK_COMPLETEDis posted for the given session when the flushing process or positive acknowledgment collection has completed. The process completes as soon as all listed receivers have responded unlessNORM_NODE_NONEis included in the "acking node" list. The sender application may use the functionNormGetAckingStatus()to determine the degree of success of the flushing process in general or for individualNormNodeIdvalues.The flushing is conducted concurrently with ongoing data transmission and does not impede the progress of reliable data transfer. Thus the sender may still enqueue NormObjects for transmission (or write to the existing stream) and the positive acknowledgement collection and flushing procedure will be multiplexed with the ongoing data transmission. However, the sender application may wish to defer from or limit itself in sending more data until a
NORM_TX_WATERMARK_COMPLETEDevent is received for the given session. This provides a form of sender->receiver(s) flow control which does not exist in NORM's default protocol operation. If a subsequent call is made toNormSetWatermark()before the current acknowledgement request has completed, the pending acknowledgment request is canceled and the new one begins.The optional
overrideFlushparameter, when set totrue, causes the watermark acknowledgment process that is established with this function call to potentially fully supersede the usual NORM end-of-transmission flushing process that occurs. IfoverrideFlushis set and the "watermark" transmission point corresponds to the last transmission that will result from data enqueued by the sending application, then the watermark flush completion will terminate the usual flushing process. I.e., if positive acknowledgement of watermark is received from the full "acking node list", then no further flushing is conducted. Thus, theoverrideFlushparameter should only be set when the "acking node list" contains a complete list of intended recipients. This is useful for small receiver groups (or unicast operation) to reduce the "chattiness" of NORM's default end-of-transmission flush process. Note that once the watermark flush is completed and further data enqueued and transmitted, the normal default end-of-transmission behavior will be resumed unless another "watermark" is set withoverrideFlushenabled. Thus, as long as new watermarks are established by successive use of this API call, this effectively "morphs" NORM into a protocol driven by positive acknowledgement behavior.#include <normApi.h> -boolNormCancelWatermark(NormSessionHandlesessionHandle);This function cancels any "watermark" acknowledgement request that was previously set via the
NormSetWatermark()function for the givensessionHandle. The status of any NORM receivers that may have acknowledged prior to cancellation can be queried using theNormGetAckingStatus()function even afterNormCancelWatermark()is called. Typically, applications should wait until a event has been posted, but in some special cases it may be useful to terminate the acknowledgement collection process early.#include <normApi.h> +boolNormCancelWatermark(NormSessionHandlesessionHandle);This function cancels any "watermark" acknowledgement request that was previously set via the
NormSetWatermark()function for the givensessionHandle. The status of any NORM receivers that may have acknowledged prior to cancellation can be queried using theNormGetAckingStatus()function even afterNormCancelWatermark()is called. Typically, applications should wait until a event has been posted, but in some special cases it may be useful to terminate the acknowledgement collection process early.#include <normApi.h> boolNormAddAckingNode(NormSessionHandlesessionHandle, -NormNodeIdnodeId);When this function is called, the specified
nodeIdis added to the list ofNormNodeIdvalues (i.e., the "acking node" list) used when NORM sender operation performs positive acknowledgement (ACK) collection for the specifiedsessionHandle. The optional NORM positive acknowledgement collection occurs when a specified transmission point (seeNormSetWatermark()) is reached or for specialized protocol actions such as positively-acknowledged application-defined commands.Additionally the special value of
nodeIdequal toNORM_NODE_NONEmay be set to force the watermark flushing process through a fullNORM_ROBUST_FACTORnumber of rounds regardless of actual acking nodes. Otherwise the flushing process is terminated when all of the nodes in the acking node list have responded. Setting a "watermark" and forcing a full flush process with the specialNORM_NODE_NONEvalue ofnodeIdenables the resultantNORM_TX_WATERMARK_COMPLETEDnotification to be a indicator with high (but not absolute) assurance that the receiver set has completed reliable reception of content up through the "watermark" transmission point. This provides a form of scalable reliable multicast "flow control" for NACK-based operation without requiring explicit positive acknowledgement from all group members. Note that the use of theNORM_NODE_NONEvalue may be mixed with othernodeIdfor a mix of positive acknowledgement collection from some nodes and a measure of assurance for the group at large.#include <normApi.h> +NormNodeIdnodeId);When this function is called, the specified
nodeIdis added to the list ofNormNodeIdvalues (i.e., the "acking node" list) used when NORM sender operation performs positive acknowledgement (ACK) collection for the specifiedsessionHandle. The optional NORM positive acknowledgement collection occurs when a specified transmission point (seeNormSetWatermark()) is reached or for specialized protocol actions such as positively-acknowledged application-defined commands.Additionally the special value of
nodeIdequal toNORM_NODE_NONEmay be set to force the watermark flushing process through a fullNORM_ROBUST_FACTORnumber of rounds regardless of actual acking nodes. Otherwise the flushing process is terminated when all of the nodes in the acking node list have responded. Setting a "watermark" and forcing a full flush process with the specialNORM_NODE_NONEvalue ofnodeIdenables the resultantNORM_TX_WATERMARK_COMPLETEDnotification to be a indicator with high (but not absolute) assurance that the receiver set has completed reliable reception of content up through the "watermark" transmission point. This provides a form of scalable reliable multicast "flow control" for NACK-based operation without requiring explicit positive acknowledgement from all group members. Note that the use of theNORM_NODE_NONEvalue may be mixed with othernodeIdfor a mix of positive acknowledgement collection from some nodes and a measure of assurance for the group at large.#include <normApi.h> voidNormRemoveAckingNode(NormSessionHandlesessionHandle, -NormNodeIdnodeId);This function deletes the specified
nodeIdfrom the list ofNormNodeIdvalues used when NORM sender operation performs positive acknowledgement (ACK) collection for the specifiedsessionHandle. Note that if the specialnodeIdvalue "NORM_NODE_NONE"has been added to the list, it too must be explicitly removed to change the watermark flushing behavior if desired.#include <normApi.h> +NormNodeIdnodeId);This function deletes the specified
nodeIdfrom the list ofNormNodeIdvalues used when NORM sender operation performs positive acknowledgement (ACK) collection for the specifiedsessionHandle. Note that if the specialnodeIdvalue "NORM_NODE_NONE"has been added to the list, it too must be explicitly removed to change the watermark flushing behavior if desired.#include <normApi.h> -NormNodeIdNormGetNextAckingNode(NormSessionHandlesession, bool reset = false);This function iteratively retrieves the
NormNodeIdvalues in the "acking node" list maintained by a NORM sender (seeNormAddAckingNode()) for the givensessionHandle. If the optionalresetparameter is set to a value oftrue, the firstNormNodeIdvalue in the list is returned and subsequent calls toNormGetNextAckingNode()with theresetparameter set to its defaultfalsevalue will iteratively return the remainingNormNodeIdvalues contained in the list. A value ofNORM_NODE_NONEis returned when the end of the list is reached.The "acking node" list is populated with application calls to
NormAddAckingNode()or auto-populated if that optional behavior is set for a NormSession. Note that this API does not enable the programmer to check if theNORM_NODE_NONEvalue itself is contained in the list. The programmer should keep track of that by other means.The following code example illustrates how to use this call to iterate through the set of stored
NormNodeIdvalues and get the current "acking status" for each:NormNodeId nextNodeId = NormGetNextAckingNode(session, true); +NormNodeIdNormGetNextAckingNode(NormSessionHandlesession, bool reset = false);This function iteratively retrieves the
NormNodeIdvalues in the "acking node" list maintained by a NORM sender (seeNormAddAckingNode()) for the givensessionHandle. If the optionalresetparameter is set to a value oftrue, the firstNormNodeIdvalue in the list is returned and subsequent calls toNormGetNextAckingNode()with theresetparameter set to its defaultfalsevalue will iteratively return the remainingNormNodeIdvalues contained in the list. A value ofNORM_NODE_NONEis returned when the end of the list is reached.The "acking node" list is populated with application calls to
NormAddAckingNode()or auto-populated if that optional behavior is set for a NormSession. Note that this API does not enable the programmer to check if theNORM_NODE_NONEvalue itself is contained in the list. The programmer should keep track of that by other means.The following code example illustrates how to use this call to iterate through the set of stored
NormNodeIdvalues and get the current "acking status" for each:NormNodeId nextNodeId = NormGetNextAckingNode(session, true); while(NORM_NODE_NONE != nextNodeId) { NormAckingStatus ackingStatus = NormGetAckingStatus(session, nextNodeId); printf("ACKing node id = %lu acking status = %d\n", nextNodeId, (int)ackingStatus); -}As noted below, a good time to check the acking status of the receiver set is after a
NORM_TX_WATERMARK_COMPLETEDnotification has occurred.The function iteratively returns
NormNodeIdvalues from the given session's local sender "acking node" list. A value ofNORM_NODE_NONEis returned when the end of the list is reached.#include <normApi.h> +}As noted below, a good time to check the acking status of the receiver set is after a
NORM_TX_WATERMARK_COMPLETEDnotification has occurred.The function iteratively returns
NormNodeIdvalues from the given session's local sender "acking node" list. A value ofNORM_NODE_NONEis returned when the end of the list is reached.#include <normApi.h>NormAckingStatusNormGetAckingStatus(NormSessionHandlesessionHandle, -NormNodeIdnodeId =NORM_NODE_ANY);This function queries the status of the watermark flushing process and/or positive acknowledgment collection initiated by a prior call to
NormSetWatermark()for the givensessionHandle. In general, it is expected that applications will invoke this function after the correspondingNORM_TX_WATERMARK_COMPLETEDevent has been posted. Setting the default parameter valuenodeId=NORM_NODE_ANYreturns a "status" indication for the overall process. Also, individualnodeIdvalues may be queried using theNormNodeIdvalues of receivers that were included in previous calls toNormAddAckingNode()to populate the sender session's acking node list.If the flushing/acknowledgment process is being used for application flow control, the sender application may wish to reset the watermark and flushing process (using
NormSetWatermark()) if the response indicates that some nodes have failed to respond. However, note that the flushing/acknowledgment process itself does elicit NACKs from receivers as needed and is interrupted and reset by any repair response that occurs. Thus, even by the time the flushing process has completed (andNORM_TX_WATERMARK_COMPLETEDis posted) once, this is an indication that the NORM protocol has made a valiant attempt to deliver the content. Resetting the watermark process can increase robustness, but it may be in vain to repeat this process multiple times when likely network connectivity has been lost or expected receivers have failed (dropped out, shut down, etc).Possible return values include:
NORM_ACK_INVALIDThe given
sessionHandleis invalid or the givennodeIdis not in the sender's acking list.
NORM_ACK_FAILUREThe positive acknowledgement collection process did not receive acknowledgment from every listed receiver (
nodeId=NORM_NODE_ANY) or the identifiednodeIddid not respond.
NORM_ACK_PENDINGThe flushing process at large has not yet completed (
nodeId=NORM_NODE_ANY) or the given individualnodeIdis still being queried for response.
NORM_ACK_SUCCESSAll receivers (
nodeId=NORM_NODE_ANY) responded with positive acknowledgement or the given specificnodeIddid acknowledge.#include <normApi.h> +NormNodeIdnodeId =NORM_NODE_ANY);This function queries the status of the watermark flushing process and/or positive acknowledgment collection initiated by a prior call to
NormSetWatermark()for the givensessionHandle. In general, it is expected that applications will invoke this function after the correspondingNORM_TX_WATERMARK_COMPLETEDevent has been posted. Setting the default parameter valuenodeId=NORM_NODE_ANYreturns a "status" indication for the overall process. Also, individualnodeIdvalues may be queried using theNormNodeIdvalues of receivers that were included in previous calls toNormAddAckingNode()to populate the sender session's acking node list.If the flushing/acknowledgment process is being used for application flow control, the sender application may wish to reset the watermark and flushing process (using
NormSetWatermark()) if the response indicates that some nodes have failed to respond. However, note that the flushing/acknowledgment process itself does elicit NACKs from receivers as needed and is interrupted and reset by any repair response that occurs. Thus, even by the time the flushing process has completed (andNORM_TX_WATERMARK_COMPLETEDis posted) once, this is an indication that the NORM protocol has made a valiant attempt to deliver the content. Resetting the watermark process can increase robustness, but it may be in vain to repeat this process multiple times when likely network connectivity has been lost or expected receivers have failed (dropped out, shut down, etc).Possible return values include:
NORM_ACK_INVALIDThe given
sessionHandleis invalid or the givennodeIdis not in the sender's acking list.
NORM_ACK_FAILUREThe positive acknowledgement collection process did not receive acknowledgment from every listed receiver (
nodeId=NORM_NODE_ANY) or the identifiednodeIddid not respond.
NORM_ACK_PENDINGThe flushing process at large has not yet completed (
nodeId=NORM_NODE_ANY) or the given individualnodeIdis still being queried for response.
NORM_ACK_SUCCESSAll receivers (
nodeId=NORM_NODE_ANY) responded with positive acknowledgement or the given specificnodeIddid acknowledge.#include <normApi.h> boolNormSendCommand(NormSessionHandlesession, const char* cmdBuffer, unsigned int cmdLength, - bool robust = false);This function enqueues a NORM application-defined command for transmission. The
cmdBufferparameter points to a buffer containing the application-defined command content that will be contained in theNORM_CMD(APPLICATION)message payload. ThecmdLengthindicates the length of this content (in bytes) and MUST be less than or equal to thesegmentLengthvalue for the givensession(seeNormStartSender()). The NORM command transmission will be multiplexed with any NORM data transmission. The command is NOT delivered reliably, but can be optionally transmitted with repetition (once per GRTT) according to the NORM transmit robust factor value (seeNormSetTxRobustFactor()) for the given session if therobustparameter is set totrue. The command transmission is subject to any congestion control or set rate limits for the NORM session. Once the command has been transmitted (with repetition ifrobustis set totrue), aNORM_TX_CMD_SENTnotification is issued. An application can only enqueue a single command at a time (i.e. theNORM_TX_CMD_SENTnotification must occur before another command can be sent). TheNormCancelCommand()call is available to terminate command transmission if needed. Note that if a rapid succession of commands are sent it is possible that the commands may be delivered to the receivers out-of-order. Also, when repetition is requested (i.e., ifrobustis set totrue) the receiver may receive duplicate copies of the same command. It is up to the application to provide any needed mechanism for detecting and/or filtering duplicate command reception.The application-defined command feature allows NORM applications to provide some out-of-band (with respect to reliable data delivery) signaling to support session management or other functions. The reception of these "atomic" commands is relatively stateless (as compared to reliable data delivery) and thus it is possible for many senders within a group to send commands without extreme resource burden on receivers (i.e. other participants). Again, this "light-weight" signaling mechanism may be used to provide ancillary communication for the group. In the future, an additional API mechanism will be provided to support application-defined positive acknowledgement requests that could conceivably be used to help guarantee command delivery if desired.
The function returns
trueupon success. The function may fail, returningfalse, if the session is not set for sender operation (seeNormStartSender()), thecmdLengthexceeds the configured sessionsegmentLength, or a previously-enqueued command has not yet been sent.This function enqueues a NORM application-defined command for transmission. The
cmdBufferparameter points to a buffer containing the application-defined command content that will be contained in theNORM_CMD(APPLICATION)message payload. ThecmdLengthindicates the length of this content (in bytes) and MUST be less than or equal to thesegmentLengthvalue for the givensession(seeNormStartSender()). The NORM command transmission will be multiplexed with any NORM data transmission. The command is NOT delivered reliably, but can be optionally transmitted with repetition (once per GRTT) according to the NORM transmit robust factor value (seeNormSetTxRobustFactor()) for the given session if therobustparameter is set totrue. The command transmission is subject to any congestion control or set rate limits for the NORM session. Once the command has been transmitted (with repetition ifrobustis set totrue), aNORM_TX_CMD_SENTnotification is issued. An application can only enqueue a single command at a time (i.e. theNORM_TX_CMD_SENTnotification must occur before another command can be sent). TheNormCancelCommand()call is available to terminate command transmission if needed. Note that if a rapid succession of commands are sent it is possible that the commands may be delivered to the receivers out-of-order. Also, when repetition is requested (i.e., ifrobustis set totrue) the receiver may receive duplicate copies of the same command. It is up to the application to provide any needed mechanism for detecting and/or filtering duplicate command reception.The application-defined command feature allows NORM applications to provide some out-of-band (with respect to reliable data delivery) signaling to support session management or other functions. The reception of these "atomic" commands is relatively stateless (as compared to reliable data delivery) and thus it is possible for many senders within a group to send commands without extreme resource burden on receivers (i.e. other participants). Again, this "light-weight" signaling mechanism may be used to provide ancillary communication for the group. In the future, an additional API mechanism will be provided to support application-defined positive acknowledgement requests that could conceivably be used to help guarantee command delivery if desired.
The function returns
trueupon success. The function may fail, returningfalse, if the session is not set for sender operation (seeNormStartSender()), thecmdLengthexceeds the configured sessionsegmentLength, or a previously-enqueued command has not yet been sent.#include <normApi.h> -voidNormCancelCommand(NormSessionHandlesession);This function terminates any pending
NORM_CMD(APPLICATION)transmission that was previously initiated with theNormSendCommand()call. Due to the asynchrony of the NORM protocol engine thread and the application, it is possible that the command may have been already sent but theNormCancelCommand()call will ensure aNORM_TX_CMD_SENTnotification is not issued for that prior command.The application-defined command feature allows NORM applications to provide some out-of-band (with respect to reliable data delivery) signaling to support session management or other functions. The reception of these "atomic" commands is relatively stateless (as compared to reliable data delivery) and thus it is possible for many senders within a group to send commands without extreme resource burden on receivers (i.e. other participants). Again, this "light-weight" signaling mechanism may be used to provide ancillary communication for the group. In the future, an additional API mechanism will be provided to support application-defined positive acknowledgement requests that could conceivably be used to help guarantee command delivery if desired.
#include <normApi.h> +voidNormCancelCommand(NormSessionHandlesession);This function terminates any pending
NORM_CMD(APPLICATION)transmission that was previously initiated with theNormSendCommand()call. Due to the asynchrony of the NORM protocol engine thread and the application, it is possible that the command may have been already sent but theNormCancelCommand()call will ensure aNORM_TX_CMD_SENTnotification is not issued for that prior command.The application-defined command feature allows NORM applications to provide some out-of-band (with respect to reliable data delivery) signaling to support session management or other functions. The reception of these "atomic" commands is relatively stateless (as compared to reliable data delivery) and thus it is possible for many senders within a group to send commands without extreme resource burden on receivers (i.e. other participants). Again, this "light-weight" signaling mechanism may be used to provide ancillary communication for the group. In the future, an additional API mechanism will be provided to support application-defined positive acknowledgement requests that could conceivably be used to help guarantee command delivery if desired.
#include <normApi.h> boolNormStartReceiver(NormSessionHandlesessionHandle, - unsigned long bufferSpace);This function initiates the application's participation as a receiver within the NormSession identified by the
sessionHandleparameter. The NORM protocol engine will begin providing the application with receiver-relatedNormEventnotifications, and, unlessNormSetSilentReceiver(true) is invoked, respond to senders with appropriate protocol messages. ThebufferSpaceparameter is used to set a limit on the amount ofbufferSpaceallocated by the receiver per active NormSender within the session. The appropriatebufferSpaceto use is a function of expected network delay*bandwidth product and packet loss characteristics. A discussion of trade-offs associated with NORM transmit and receiver buffer space selection is provided later in this document. An insufficientbufferSpaceallocation will result in potentially inefficient protocol operation, even though reliable operation may be maintained. In some cases of a large delay*bandwidth product and/or severe packet loss, a smallbufferSpaceallocation (coupled with the lack of explicit flow control in NORM) may result in the receiver "re-syncing" to the sender, resulting in "outages" in the reliable transmissions from a sender (this is analogous to a TCP connection timeout failure).This function initiates the application's participation as a receiver within the NormSession identified by the
sessionHandleparameter. The NORM protocol engine will begin providing the application with receiver-relatedNormEventnotifications, and, unlessNormSetSilentReceiver(true) is invoked, respond to senders with appropriate protocol messages. ThebufferSpaceparameter is used to set a limit on the amount ofbufferSpaceallocated by the receiver per active NormSender within the session. The appropriatebufferSpaceto use is a function of expected network delay*bandwidth product and packet loss characteristics. A discussion of trade-offs associated with NORM transmit and receiver buffer space selection is provided later in this document. An insufficientbufferSpaceallocation will result in potentially inefficient protocol operation, even though reliable operation may be maintained. In some cases of a large delay*bandwidth product and/or severe packet loss, a smallbufferSpaceallocation (coupled with the lack of explicit flow control in NORM) may result in the receiver "re-syncing" to the sender, resulting in "outages" in the reliable transmissions from a sender (this is analogous to a TCP connection timeout failure).#include <normApi.h> voidNormStopReceiver(NormSessionHandlesessionHandle, - unsigned int gracePeriod = 0);This function ends the application's participation as a receiver in the NormSession specified by the session parameter. By default, all receiver-related protocol activity is immediately halted and all receiver-related resources are freed (except for those which have been specifically retained (see
NormNodeRetain()andNormObjectRetain()). However, and optionalgracePeriodparameter is provided to allow the receiver an opportunity to inform the group of its intention. This is applicable when the local receiving NormNode has been designated as an active congestion control representative (i.e. current limiting receiver (CLR) or potential limiting receiver (PLR)). In this case, a non-zerogracePeriodvalue provides an opportunity for the receiver to respond to the applicable sender(s) so the sender will not expect further congestion control feedback from this receiver. ThegracePeriodinteger value is used as a multiplier with the largest sender GRTT to determine the actual time period for which the receiver will linger in the group to provide such feedback (i.e."graceTime" = (). During this time, the receiver will not generate any requests for repair or other protocol actions aside from response to applicable congestion control probes. When the receiver is removed from the current list of receivers in the sender congestion control probe messages (or thegracePeriod* GRTT)gracePeriodexpires, whichever comes first), the NORM protocol engine will post aNORM_LOCAL_RECEIVER_CLOSEDevent for the applicable session, and related resources are then freed.This function ends the application's participation as a receiver in the NormSession specified by the session parameter. By default, all receiver-related protocol activity is immediately halted and all receiver-related resources are freed (except for those which have been specifically retained (see
NormNodeRetain()andNormObjectRetain()). However, and optionalgracePeriodparameter is provided to allow the receiver an opportunity to inform the group of its intention. This is applicable when the local receiving NormNode has been designated as an active congestion control representative (i.e. current limiting receiver (CLR) or potential limiting receiver (PLR)). In this case, a non-zerogracePeriodvalue provides an opportunity for the receiver to respond to the applicable sender(s) so the sender will not expect further congestion control feedback from this receiver. ThegracePeriodinteger value is used as a multiplier with the largest sender GRTT to determine the actual time period for which the receiver will linger in the group to provide such feedback (i.e."graceTime" = (). During this time, the receiver will not generate any requests for repair or other protocol actions aside from response to applicable congestion control probes. When the receiver is removed from the current list of receivers in the sender congestion control probe messages (or thegracePeriod* GRTT)gracePeriodexpires, whichever comes first), the NORM protocol engine will post aNORM_LOCAL_RECEIVER_CLOSEDevent for the applicable session, and related resources are then freed.#include <normApi.h> voidNormSetRxCacheLimit(NormSessionHandlesessionHandle, - unsigned short countMax);This function sets a limit on the number of outstanding (pending) NormObjects for which a receiver will keep state on a per-sender basis. Note that the value
countMaxsets a limit on the maximum consecutive range of objects that can be pending. The default value (when this function is not called) ofcountMaxis256. This should be sufficient for most bulk transfer usage, but if small object sizes (e.g. smallNORM_OBJECT_DATAmessages) are being transferred, it may be useful to raise this limit in cases of high transmission speeds or large <delay*bandwidth, loss> network conditions. If the receiver cache limit is set too small (i.e. for high speed or large <delay*bandwidth> operation), the receiver may not maintain reliable reception or impact session throughput when flow control is enabled (seeNormSetFlowControl()). The maximum allowed value ofcountMaxis16,384.If this value is changed after
NormStartReceiver()has been called, it will only affect newly-detected remote senders, so this should typically be called before NORM receiver operation is initiated.This function sets a limit on the number of outstanding (pending) NormObjects for which a receiver will keep state on a per-sender basis. Note that the value
countMaxsets a limit on the maximum consecutive range of objects that can be pending. The default value (when this function is not called) ofcountMaxis256. This should be sufficient for most bulk transfer usage, but if small object sizes (e.g. smallNORM_OBJECT_DATAmessages) are being transferred, it may be useful to raise this limit in cases of high transmission speeds or large <delay*bandwidth, loss> network conditions. If the receiver cache limit is set too small (i.e. for high speed or large <delay*bandwidth> operation), the receiver may not maintain reliable reception or impact session throughput when flow control is enabled (seeNormSetFlowControl()). The maximum allowed value ofcountMaxis16,384.If this value is changed after
NormStartReceiver()has been called, it will only affect newly-detected remote senders, so this should typically be called before NORM receiver operation is initiated.#include <normApi.h> boolNormSetRxSocketBuffer(NormSessionHandlesessionHandle, - unsigned int bufferSize);This function allows the application to set an alternative, non-default buffer size for the UDP socket used by the specified NORM
sessionHandlefor packet reception. This may be necessary for high speed NORM sessions where the UDP receive socket buffer becomes a bottleneck when the NORM protocol engine (which is running as a user-space process) doesn't get to service the receive socket quickly enough resulting in packet loss when the socket buffer overflows. ThebufferSizeparameter specifies the socket buffer size in bytes. Different operating systems and sometimes system configurations allow different ranges of socket buffer sizes to be set. Note that a call toNormStartReceiver()(orNormStartSender()) must have been previously made for this call to succeed (i.e., the socket must be already open).This function returns
trueupon success andfalseupon failure. Possible reasons for failure include, 1) the specified session is not valid, 2) that NORM "receiver" (or "sender") operation has not yet been started for the given session, or 3) an invalidbufferSizespecification was given.This function allows the application to set an alternative, non-default buffer size for the UDP socket used by the specified NORM
sessionHandlefor packet reception. This may be necessary for high speed NORM sessions where the UDP receive socket buffer becomes a bottleneck when the NORM protocol engine (which is running as a user-space process) doesn't get to service the receive socket quickly enough resulting in packet loss when the socket buffer overflows. ThebufferSizeparameter specifies the socket buffer size in bytes. Different operating systems and sometimes system configurations allow different ranges of socket buffer sizes to be set. Note that a call toNormStartReceiver()(orNormStartSender()) must have been previously made for this call to succeed (i.e., the socket must be already open).This function returns
trueupon success andfalseupon failure. Possible reasons for failure include, 1) the specified session is not valid, 2) that NORM "receiver" (or "sender") operation has not yet been started for the given session, or 3) an invalidbufferSizespecification was given.#include <normApi.h> voidNormSetSilentReceiver(NormSessionHandlesessionHandle, bool silent, - INT32 maxDelay = -1);This function provides the option to configure a NORM receiver application as a "silent receiver". This mode of receiver operation dictates that the host does not generate any protocol messages while operating as a receiver within the specified
sessionHandle. Setting thesilentparameter totrueenables silent receiver operation while setting it tofalseresults in normal protocol operation where feedback is provided as needed for reliability and protocol operation. Silent receivers are dependent upon proactive FEC transmission (seeNormSetAutoParity()) or using repair information requested by other non-silent receivers within the group to achieve reliable transfers.The optional
maxDelayparameter is most applicable for reception of theNORM_OBJECT_STREAMtype. The default value ofmaxDelay=-1corresponds to normal operation where source data segments for incompletely-received FEC coding blocks (or transport objects) are passed to the application only when imposed buffer constraints (either theNORM_OBJECT_STREAMbuffer size (seeNormStreamOpen()) or the FEC receive buffer limit (seeNormStartReceiver()) require. Thus, the default behavior (maxDelay=-1), causes the receiver to buffer received FEC code blocks for as long as possible (within buffer constraints as newer data arrives) before allowing the application to read the data. Hence, the receive latency (delay) can be quite long depending upon buffer size settings, transmission rate, etc. When themaxDelayparameter is set to a non-negative value, the value determines the maximum number of FEC coding blocks (according to a NORM sender's current transmit position) the receiver will cache an incompletely-received FEC block before giving the application the (incomplete) set of received source segments. For example, a value ofmaxDelay=0will provide the receive application with any data from the previous FEC block as soon as a subsequent FEC block is begun reception. However, this provide no protection against the possibility of out-of-order delivery of packets by the network. Therefore, if lower latency operation is desired when using silent receivers, a minimummaxDelayvalue of1is recommended. ForNORM_OBJECT_FILEandNORM_OBJECT_DATA, the only impact of a non-negativemaxDelayvalue is that previous transport objects will be immediately aborted when subsequent object begin reception. Thus, it is not usually recommended to apply a non-negativemaxDelayvalue whenNORM_OBJECT_STREAMis not being used.This function provides the option to configure a NORM receiver application as a "silent receiver". This mode of receiver operation dictates that the host does not generate any protocol messages while operating as a receiver within the specified
sessionHandle. Setting thesilentparameter totrueenables silent receiver operation while setting it tofalseresults in normal protocol operation where feedback is provided as needed for reliability and protocol operation. Silent receivers are dependent upon proactive FEC transmission (seeNormSetAutoParity()) or using repair information requested by other non-silent receivers within the group to achieve reliable transfers.The optional
maxDelayparameter is most applicable for reception of theNORM_OBJECT_STREAMtype. The default value ofmaxDelay=-1corresponds to normal operation where source data segments for incompletely-received FEC coding blocks (or transport objects) are passed to the application only when imposed buffer constraints (either theNORM_OBJECT_STREAMbuffer size (seeNormStreamOpen()) or the FEC receive buffer limit (seeNormStartReceiver()) require. Thus, the default behavior (maxDelay=-1), causes the receiver to buffer received FEC code blocks for as long as possible (within buffer constraints as newer data arrives) before allowing the application to read the data. Hence, the receive latency (delay) can be quite long depending upon buffer size settings, transmission rate, etc. When themaxDelayparameter is set to a non-negative value, the value determines the maximum number of FEC coding blocks (according to a NORM sender's current transmit position) the receiver will cache an incompletely-received FEC block before giving the application the (incomplete) set of received source segments. For example, a value ofmaxDelay=0will provide the receive application with any data from the previous FEC block as soon as a subsequent FEC block is begun reception. However, this provide no protection against the possibility of out-of-order delivery of packets by the network. Therefore, if lower latency operation is desired when using silent receivers, a minimummaxDelayvalue of1is recommended. ForNORM_OBJECT_FILEandNORM_OBJECT_DATA, the only impact of a non-negativemaxDelayvalue is that previous transport objects will be immediately aborted when subsequent object begin reception. Thus, it is not usually recommended to apply a non-negativemaxDelayvalue whenNORM_OBJECT_STREAMis not being used.#include <normApi.h> voidNormSetDefaultUnicastNack(NormSessionHandlesessionHandle, - bool enable);This function controls the default behavior determining the destination of receiver feedback messages generated while participating in the session. If the
enableparameter is true, "unicast NACKing" is enabled for new remote senders while it is disabled for state equal to false. The NACKing behavior for current remote senders is not affected. When "unicast NACKing" is disabled (default), NACK messages are sent to the session address (usually a multicast address) and port, but when "unicast NACKing" is enabled, receiver feedback messages are sent to the unicast address (and port) based on the source address of sender messages received. For unicast NORM sessions, it is recommended that "unicast NACKing" be enabled. Note that receiver feedback messages subject to potential "unicast NACKing" include NACK-messages as well as some ACK messages such as congestion control feedback. Explicitly solicited ACK messages, such as those used to satisfy sender watermark acknowledgement requests (seeNormSetWatermark()) are always unicast to the applicable sender. (TBD - provide API option so that all messages are multicast.) The default session-wide behavior for unicast NACKing can be overridden via theNormNodeSetUnicastNack()function for individual remote senders.This function controls the default behavior determining the destination of receiver feedback messages generated while participating in the session. If the
enableparameter is true, "unicast NACKing" is enabled for new remote senders while it is disabled for state equal to false. The NACKing behavior for current remote senders is not affected. When "unicast NACKing" is disabled (default), NACK messages are sent to the session address (usually a multicast address) and port, but when "unicast NACKing" is enabled, receiver feedback messages are sent to the unicast address (and port) based on the source address of sender messages received. For unicast NORM sessions, it is recommended that "unicast NACKing" be enabled. Note that receiver feedback messages subject to potential "unicast NACKing" include NACK-messages as well as some ACK messages such as congestion control feedback. Explicitly solicited ACK messages, such as those used to satisfy sender watermark acknowledgement requests (seeNormSetWatermark()) are always unicast to the applicable sender. (TBD - provide API option so that all messages are multicast.) The default session-wide behavior for unicast NACKing can be overridden via theNormNodeSetUnicastNack()function for individual remote senders.#include <normApi.h> voidNormNodeSetUnicastNack(NormNodeHandlesenderNode, - bool enable);This function controls the destination address of receiver feedback messages generated in response to a specific remote NORM sender corresponding to the
senderNodeparameter. Ifenableistrue, "unicast NACKing" is enabled while it is disabled forenableequal tofalse. See the description ofNormSetDefaultUnicastNack()for details on "unicast NACKing" behavior.This function controls the destination address of receiver feedback messages generated in response to a specific remote NORM sender corresponding to the
senderNodeparameter. Ifenableistrue, "unicast NACKing" is enabled while it is disabled forenableequal tofalse. See the description ofNormSetDefaultUnicastNack()for details on "unicast NACKing" behavior.#include <normApi.h> voidNormSetDefaultSyncPolicy(NormSessionHandlesessionHandle, -NormSyncPolicysyncPolicy);This function sets the default "synchronization policy" used when beginning (or restarting) reception of objects from a remote sender (i.e., "syncing" to the sender) for the given
sessionHandle. The "synchronization policy" is the behavior observed by the receiver with regards to what objects it attempts to reliably receive (via transmissions of Negative Acknowledgements to the sender(s) or group as needed). There are currently two synchronization policy types defined:
NORM_SYNC_CURRENTAttempt reception of "current" and new objects only. (default)
NORM_SYNC_ALLAttempt recovery and reliable reception of all objects held in sender transmit object cache and newer objects.
The behavior of a receiver using the default
NORM_SYNC_CURRENTpolicy is to attempt reliable reception only for the first received "current" and newer (with respect to the ordinal NORM object transport identifiers used by the protocol) objects from a given NORM sender. Additionally, reliable reception is only attempted when receiving a non-repairNORM_DATAmessage (or optionally a NORM positive acknowledgement request) from the first forward error correction (FEC) encoding block of the given object. This somewhat conservative synchronization behavior helps prevent late-joining (or otherwise "flaky" with respect to group membership) receivers from penalizing other receivers in the group by causing the sender to "rewind" and transmit older object content to satisfy the late joiner instead of moving forward with transmission of new content. For large scale, loosely-organized multicast applications, theNORM_SYNC_CURRENTpolicy is typically recommended.The
NORM_SYNC_ALLpolicy allows newly joining receivers much more aggressive behavior as they will immediately NACK for all objects from the "current" object backwards through the entire range of objects set by theNormSetRxCacheLimit()function. This behavior depends upon the sender to issue an appropriateNORM_CMD(SQUELCH)response (if applicable) to align (i.e. "synchronize") the new receiver with its current transmit object cache (similar to a "repair window"). This synchronization behavior may be useful for unicast uses of NORM or other applications where the group membership is more carefully managed and it is important that all content (including older content) is received. Note that the sender transmit cache bounds (seeNormSetTxCacheBounds()) and the receiver receive cache limit (seeNormSetRxCacheLimit()) settings will limit how far back onto the sender transmission history that transmitted objects can be reliably recovered from the "current" transmission point when the receiver begins reception.When this function is not invoked, the
NORM_SYNC_CURRENTbehavior is observed as the default receiver synchronization policy. This call SHOULD be made beforeNormStartReceiver()is called.#include <normApi.h> +NormSyncPolicysyncPolicy);This function sets the default "synchronization policy" used when beginning (or restarting) reception of objects from a remote sender (i.e., "syncing" to the sender) for the given
sessionHandle. The "synchronization policy" is the behavior observed by the receiver with regards to what objects it attempts to reliably receive (via transmissions of Negative Acknowledgements to the sender(s) or group as needed). There are currently two synchronization policy types defined:
NORM_SYNC_CURRENTAttempt reception of "current" and new objects only. (default)
NORM_SYNC_ALLAttempt recovery and reliable reception of all objects held in sender transmit object cache and newer objects.
The behavior of a receiver using the default
NORM_SYNC_CURRENTpolicy is to attempt reliable reception only for the first received "current" and newer (with respect to the ordinal NORM object transport identifiers used by the protocol) objects from a given NORM sender. Additionally, reliable reception is only attempted when receiving a non-repairNORM_DATAmessage (or optionally a NORM positive acknowledgement request) from the first forward error correction (FEC) encoding block of the given object. This somewhat conservative synchronization behavior helps prevent late-joining (or otherwise "flaky" with respect to group membership) receivers from penalizing other receivers in the group by causing the sender to "rewind" and transmit older object content to satisfy the late joiner instead of moving forward with transmission of new content. For large scale, loosely-organized multicast applications, theNORM_SYNC_CURRENTpolicy is typically recommended.The
NORM_SYNC_ALLpolicy allows newly joining receivers much more aggressive behavior as they will immediately NACK for all objects from the "current" object backwards through the entire range of objects set by theNormSetRxCacheLimit()function. This behavior depends upon the sender to issue an appropriateNORM_CMD(SQUELCH)response (if applicable) to align (i.e. "synchronize") the new receiver with its current transmit object cache (similar to a "repair window"). This synchronization behavior may be useful for unicast uses of NORM or other applications where the group membership is more carefully managed and it is important that all content (including older content) is received. Note that the sender transmit cache bounds (seeNormSetTxCacheBounds()) and the receiver receive cache limit (seeNormSetRxCacheLimit()) settings will limit how far back onto the sender transmission history that transmitted objects can be reliably recovered from the "current" transmission point when the receiver begins reception.When this function is not invoked, the
NORM_SYNC_CURRENTbehavior is observed as the default receiver synchronization policy. This call SHOULD be made beforeNormStartReceiver()is called.#include <normApi.h> voidNormSetDefaultNackingMode(NormSessionHandlesessionHandle, -NormNackingModenackingMode);This function sets the default "nacking mode" used when receiving objects for the given
sessionHandle. This allows the receiver application some control of its degree of participation in the repair process. By limiting receivers to only request repair of objects in which they are really interested in receiving, some overall savings in unnecessary network loading might be realized for some applications and users. Available nacking modes include:
NORM_NACK_NONEDo not transmit any repair requests for the newly received object.
NORM_NACK_INFO_ONLYTransmit repair requests for
NORM_INFOcontent only as needed.
NORM_NACK_NORMALTransmit repair requests for entire object as needed.
This function specifies the default behavior with respect to any new sender or object. This default behavior may be overridden for specific sender nodes or specific object using
NormNodeSetNackingMode()orNormObjectSetNackingMode(), respectively. The receiver application's use ofNORM_NACK_NONEessentially disables a guarantee of reliable reception, although the receiver may still take advantage of sender repair transmissions in response to other receivers' requests. When the sender provides,NORM_INFOcontent for transmitted objects, theNORM_NACK_INFO_ONLYmode may allows the receiver to reliably receive object context information from which it may choose to "upgrade" itsnackingModefor the specific object via theNormObjectSetNackingMode()call. Similarly, the receiver may changes its defaultnackingModewith respect to specific senders via theNormNodeSetNackingMode()call. The default "defaultnackingMode" when this call is not made isNORM_NACK_NORMAL.#include <normApi.h> +NormNackingModenackingMode);This function sets the default "nacking mode" used when receiving objects for the given
sessionHandle. This allows the receiver application some control of its degree of participation in the repair process. By limiting receivers to only request repair of objects in which they are really interested in receiving, some overall savings in unnecessary network loading might be realized for some applications and users. Available nacking modes include:
NORM_NACK_NONEDo not transmit any repair requests for the newly received object.
NORM_NACK_INFO_ONLYTransmit repair requests for
NORM_INFOcontent only as needed.
NORM_NACK_NORMALTransmit repair requests for entire object as needed.
This function specifies the default behavior with respect to any new sender or object. This default behavior may be overridden for specific sender nodes or specific object using
NormNodeSetNackingMode()orNormObjectSetNackingMode(), respectively. The receiver application's use ofNORM_NACK_NONEessentially disables a guarantee of reliable reception, although the receiver may still take advantage of sender repair transmissions in response to other receivers' requests. When the sender provides,NORM_INFOcontent for transmitted objects, theNORM_NACK_INFO_ONLYmode may allows the receiver to reliably receive object context information from which it may choose to "upgrade" itsnackingModefor the specific object via theNormObjectSetNackingMode()call. Similarly, the receiver may changes its defaultnackingModewith respect to specific senders via theNormNodeSetNackingMode()call. The default "defaultnackingMode" when this call is not made isNORM_NACK_NORMAL.#include <normApi.h> voidNormNodeSetNackingMode(NormNodeHandlenodeHandle, -NormNackingModenackingMode);This function sets the default "nacking mode" used for receiving new objects from a specific sender as identified by the
nodeHandleparameter. This overrides the defaultnackingModeset for the receive session. SeeNormSetDefaultNackingMode()for a description of possiblenackingModeparameter values and other related information.#include <normApi.h> +NormNackingModenackingMode);This function sets the default "nacking mode" used for receiving new objects from a specific sender as identified by the
nodeHandleparameter. This overrides the defaultnackingModeset for the receive session. SeeNormSetDefaultNackingMode()for a description of possiblenackingModeparameter values and other related information.#include <normApi.h> voidNormObjectSetNackingMode(NormObjectHandleobjectHandle, -NormNackingModenackingMode);This function sets the "nacking mode" used for receiving a specific transport object as identified by the
objectHandleparameter. This overrides the default nacking mode set for the applicable sender node. SeeNormSetDefaultNackingMode()for a description of possiblenackingModeparameter values and other related information.#include <normApi.h> +NormNackingModenackingMode);This function sets the "nacking mode" used for receiving a specific transport object as identified by the
objectHandleparameter. This overrides the default nacking mode set for the applicable sender node. SeeNormSetDefaultNackingMode()for a description of possiblenackingModeparameter values and other related information.#include <normApi.h> voidNormSetDefaultRepairBoundary(NormSessionHandlesessionHandle, -NormRepairBoundaryrepairBoundary);This function allows the receiver application to customize, for a given
sessionHandle, at what points the receiver initiates the NORM NACK repair process during protocol operation. Normally, the NORM receiver initiates NACKing for repairs at the FEC code block and transport object boundaries. For smaller block sizes, the NACK repair process is often/quickly initiated and the repair of an object will occur, as needed, during the transmission of the object. This default operation corresponds torepairBoundaryequal toNORM_BOUNDARY_BLOCK. Using this function, the application may alternatively, settingrepairBoundaryequal toNORM_BOUNDARY_OBJECT, cause the protocol to defer NACK process initiation until the current transport object has been completely transmitted.#include <normApi.h> +NormRepairBoundaryrepairBoundary);This function allows the receiver application to customize, for a given
sessionHandle, at what points the receiver initiates the NORM NACK repair process during protocol operation. Normally, the NORM receiver initiates NACKing for repairs at the FEC code block and transport object boundaries. For smaller block sizes, the NACK repair process is often/quickly initiated and the repair of an object will occur, as needed, during the transmission of the object. This default operation corresponds torepairBoundaryequal toNORM_BOUNDARY_BLOCK. Using this function, the application may alternatively, settingrepairBoundaryequal toNORM_BOUNDARY_OBJECT, cause the protocol to defer NACK process initiation until the current transport object has been completely transmitted.#include <normApi.h> voidNormNodeSetRepairBoundary(NormNodeHandlenodeHandle, -NormRepairBoundaryrepairBoundary);This function allows the receiver application to customize, for the specific remote sender referenced by the
nodeHandleparameter, at what points the receiver initiates the NORM NACK repair process during protocol operation. See the description ofNormSetDefaultRepairBoundary()for further details on the impact of setting the NORM receiver repair boundary and possible values for therepairBoundaryparameter.#include <normApi.h> +NormRepairBoundaryrepairBoundary);This function allows the receiver application to customize, for the specific remote sender referenced by the
nodeHandleparameter, at what points the receiver initiates the NORM NACK repair process during protocol operation. See the description ofNormSetDefaultRepairBoundary()for further details on the impact of setting the NORM receiver repair boundary and possible values for therepairBoundaryparameter.#include <normApi.h> voidNormSetDefaultRxRobustFactor(NormSessionHandlesessionHandle, - int rxRobustFactor);This routine controls how persistently NORM receivers will maintain state for sender(s) and continue to request repairs from the sender(s) even when packet reception has ceased. The
rxRobustFactorvalue determines how many times a NORM receiver will self-initiate NACKing (repair requests) upon cessation of packet reception from a sender. The default value is20. SettingrxRobustFactorto-1will make the NORM receiver infinitely persistent (i.e., it will continue to NACK indefinitely as long as it is missing data content). It is important to note that theNormSetTxRobustFactor()also affects receiver operation in setting the time interval that is used to gauge that sender packet transmission has ceased (i.e., the sender inactivity timeout). This "timeout" interval is a equal of (). Thus the overall timeout before a NORM receiver quits NACKing is (2* GRTT *txRobustFactor).rxRobustFactor*2* GRTT *txRobustFactorThe
NormNodeSetRxRobustFactor()function can be used to control this behavior on a per-sender basis. When a new remote sender is detected, the defaultrxRobustFactorset here is used. Again, the default value is20.This routine controls how persistently NORM receivers will maintain state for sender(s) and continue to request repairs from the sender(s) even when packet reception has ceased. The
rxRobustFactorvalue determines how many times a NORM receiver will self-initiate NACKing (repair requests) upon cessation of packet reception from a sender. The default value is20. SettingrxRobustFactorto-1will make the NORM receiver infinitely persistent (i.e., it will continue to NACK indefinitely as long as it is missing data content). It is important to note that theNormSetTxRobustFactor()also affects receiver operation in setting the time interval that is used to gauge that sender packet transmission has ceased (i.e., the sender inactivity timeout). This "timeout" interval is a equal of (). Thus the overall timeout before a NORM receiver quits NACKing is (2* GRTT *txRobustFactor).rxRobustFactor*2* GRTT *txRobustFactorThe
NormNodeSetRxRobustFactor()function can be used to control this behavior on a per-sender basis. When a new remote sender is detected, the defaultrxRobustFactorset here is used. Again, the default value is20.#include <normApi.h> voidNormNodeSetRxRobustFactor(NormNodeHandlenodeHandle, - int rxRobustFactor);This routine sets the
rxRobustFactoras described inNormSetDefaultRxRobustFactor()for an individual remote sender identified by thenodeHandleparameter. See the description ofNormSetDefaultRxRobustFactor()for detailsThis routine sets the
rxRobustFactoras described inNormSetDefaultRxRobustFactor()for an individual remote sender identified by thenodeHandleparameter. See the description ofNormSetDefaultRxRobustFactor()for details#include <normApi.h> boolNormStreamRead(NormObjectHandlestreamHandle, char* buffer - unsigned int* numBytes);This function can be used by the receiver application to read any available data from an incoming NORM stream. NORM receiver applications "learn" of available NORM streams via
NORM_RX_OBJECT_NEWnotification events. ThestreamHandleparameter here must correspond to a validNormObjectHandlevalue provided during such a priorNORM_RX_OBJECT_NEWnotification. Thebufferparameter must be a pointer to an array where the received data can be stored of a length as referenced by thenumBytespointer. On successful completion, thenumBytesstorage will be modified to indicate the actual number of bytes copied into the providedbuffer. If thenumBytesstorage is modified to a zero value, this indicates that no stream data was currently available for reading.Note that
NormStreamRead()is never a blocking call and only returns failure (false) when a break in the integrity of the received stream occurs. TheNORM_RX_OBJECT_UPDATEprovides an indication to when there is stream data available for reading. When such notification occurs, the application should repeatedly read from the stream until thenumBytesstorage is set to zero, even if afalsevalue is returned. AdditionalNORM_RX_OBJECT_UPDATEnotifications might not be posted until the application has read all available data.This function normally returns a value of
true. However, if a break in the integrity of the reliable received stream occurs (or the stream has been ended by the sender), a value offalseis returned to indicate the break. Unless the stream has been ended (and the receiver application will receiveNORM_RX_OBJECT_COMPLETEDnotification for the stream in that case), the application may continue to read from the stream as the NORM protocol will automatically "resync" to streams, even if network conditions are sufficiently poor that breaks in reliability occur. If such a "break" and "resync" occurs, the application may be able to leverage other NORM API calls such asNormStreamSeekMsgStart()orNormStreamGetReadOffset()if needed to recover its alignment with received stream content. This depends upon the nature of the application and its stream content.This function can be used by the receiver application to read any available data from an incoming NORM stream. NORM receiver applications "learn" of available NORM streams via
NORM_RX_OBJECT_NEWnotification events. ThestreamHandleparameter here must correspond to a validNormObjectHandlevalue provided during such a priorNORM_RX_OBJECT_NEWnotification. Thebufferparameter must be a pointer to an array where the received data can be stored of a length as referenced by thenumBytespointer. On successful completion, thenumBytesstorage will be modified to indicate the actual number of bytes copied into the providedbuffer. If thenumBytesstorage is modified to a zero value, this indicates that no stream data was currently available for reading.Note that
NormStreamRead()is never a blocking call and only returns failure (false) when a break in the integrity of the received stream occurs. TheNORM_RX_OBJECT_UPDATEprovides an indication to when there is stream data available for reading. When such notification occurs, the application should repeatedly read from the stream until thenumBytesstorage is set to zero, even if afalsevalue is returned. AdditionalNORM_RX_OBJECT_UPDATEnotifications might not be posted until the application has read all available data.This function normally returns a value of
true. However, if a break in the integrity of the reliable received stream occurs (or the stream has been ended by the sender), a value offalseis returned to indicate the break. Unless the stream has been ended (and the receiver application will receiveNORM_RX_OBJECT_COMPLETEDnotification for the stream in that case), the application may continue to read from the stream as the NORM protocol will automatically "resync" to streams, even if network conditions are sufficiently poor that breaks in reliability occur. If such a "break" and "resync" occurs, the application may be able to leverage other NORM API calls such asNormStreamSeekMsgStart()orNormStreamGetReadOffset()if needed to recover its alignment with received stream content. This depends upon the nature of the application and its stream content.#include <normApi.h> -boolNormStreamSeekMsgStart(NormObjectHandlestreamHandle);This function advances the read offset of the receive stream referenced by the
streamHandleparameter to align with the next available message boundary. Message boundaries are defined by the sender application using theNormStreamMarkEom()call. Note that any received data prior to the next message boundary is discarded by the NORM protocol engine and is not available to the application (i.e., there is currently no "rewind" function for a NORM stream). Also note this call cannot be used to skip messages. Once a valid message boundary is found, the application must read from the stream usingNormStreamRead()to further advance the read offset. The current offset (in bytes) for the stream can be retrieved viaNormStreamGetReadOffset().This function returns a value of
truewhen start-of-message is found. The next call toNormStreamRead()will retrieve data aligned with the message start. If no new message boundary is found in the buffered receive data for the stream, the function returns a value offalse. In this case, the application should defer repeating a call to this function until a subsequentNORM_RX_OBJECT_UPDATEnotification is posted.#include <normApi.h> +boolNormStreamSeekMsgStart(NormObjectHandlestreamHandle);This function advances the read offset of the receive stream referenced by the
streamHandleparameter to align with the next available message boundary. Message boundaries are defined by the sender application using theNormStreamMarkEom()call. Note that any received data prior to the next message boundary is discarded by the NORM protocol engine and is not available to the application (i.e., there is currently no "rewind" function for a NORM stream). Also note this call cannot be used to skip messages. Once a valid message boundary is found, the application must read from the stream usingNormStreamRead()to further advance the read offset. The current offset (in bytes) for the stream can be retrieved viaNormStreamGetReadOffset().This function returns a value of
truewhen start-of-message is found. The next call toNormStreamRead()will retrieve data aligned with the message start. If no new message boundary is found in the buffered receive data for the stream, the function returns a value offalse. In this case, the application should defer repeating a call to this function until a subsequentNORM_RX_OBJECT_UPDATEnotification is posted.#include <normApi.h> -unsigned longNormStreamGetReadOffset(NormObjectHandlestreamHandle);This function retrieves the current read offset value for the receive stream indicated by the
streamHandleparameter. Note that for very long-lived streams, this value may wrap. Thus, in general, applications should not be highly dependent upon the stream offset, but this feature may be valuable for certain applications which associate some application context with stream position.The functions described in this section may be used for sender or receiver purposes to manage transmission and reception of NORM transport objects. In most cases, the receiver will be the typical user of these functions to retrieve additional information on newly-received objects. All of these functions require a valid
NormObjectHandleargument which specifies the applicable object. Note thatNormObjectHandlevalues obtained from aNormEventnotification may be considered valid only until a subsequent call toNormGetNextEvent(), unless explicitly retained by the application (seeNormObjectRetain()).NormObjectHandlevalues obtained as a result ofNormFileEnqueue(),NormDataEnqueue(), orNormStreamOpen()calls can be considered valid only until a correspondingNORM_TX_OBJECT_PURGEDnotification is posted or the object is dequeued usingNormObjectCancel(), unless, again, otherwise explicitly retained (seeNormObjectRetain()).#include <normApi.h> +unsigned longNormStreamGetReadOffset(NormObjectHandlestreamHandle);This function retrieves the current read offset value for the receive stream indicated by the
streamHandleparameter. Note that for very long-lived streams, this value may wrap. Thus, in general, applications should not be highly dependent upon the stream offset, but this feature may be valuable for certain applications which associate some application context with stream position.The functions described in this section may be used for sender or receiver purposes to manage transmission and reception of NORM transport objects. In most cases, the receiver will be the typical user of these functions to retrieve additional information on newly-received objects. All of these functions require a valid
NormObjectHandleargument which specifies the applicable object. Note thatNormObjectHandlevalues obtained from aNormEventnotification may be considered valid only until a subsequent call toNormGetNextEvent(), unless explicitly retained by the application (seeNormObjectRetain()).NormObjectHandlevalues obtained as a result ofNormFileEnqueue(),NormDataEnqueue(), orNormStreamOpen()calls can be considered valid only until a correspondingNORM_TX_OBJECT_PURGEDnotification is posted or the object is dequeued usingNormObjectCancel(), unless, again, otherwise explicitly retained (seeNormObjectRetain()).#include <normApi.h> -NormObjectTypeNormObjectGetType(NormObjectHandleobjectHandle);This function can be used to determine the object type (
(NORM_OBJECT_DAT,NORM_OBJECT_FILE, orNORM_OBJECT_STREAM) for the NORM transport object identified by theobjectHandleparameter. TheobjectHandlemust refer to a current, valid transport object.#include <normApi.h> +NormObjectTypeNormObjectGetType(NormObjectHandleobjectHandle);This function can be used to determine the object type (
(NORM_OBJECT_DAT,NORM_OBJECT_FILE, orNORM_OBJECT_STREAM) for the NORM transport object identified by theobjectHandleparameter. TheobjectHandlemust refer to a current, valid transport object.#include <normApi.h> -boolNormObjectHasInfo(NormObjectHandleobjectHandle);This function can be used to determine if the sender has associated any
NORM_INFOcontent with the transport object specified by theobjectHandleparameter. This can even be used before theNORM_INFOcontent is delivered to the receiver and aNORM_RX_OBJECT_INFOnotification is posted.#include <normApi.h> +boolNormObjectHasInfo(NormObjectHandleobjectHandle);This function can be used to determine if the sender has associated any
NORM_INFOcontent with the transport object specified by theobjectHandleparameter. This can even be used before theNORM_INFOcontent is delivered to the receiver and aNORM_RX_OBJECT_INFOnotification is posted.#include <normApi.h> -unsigned shortNormObjectGetInfoLength(NormObjectHandleobjectHandle);This function can be used to determine the length of currently available
NORM_INFOcontent (if any) associated with the transport object referenced by theobjectHandleparameter.#include <normApi.h> +unsigned shortNormObjectGetInfoLength(NormObjectHandleobjectHandle);This function can be used to determine the length of currently available
NORM_INFOcontent (if any) associated with the transport object referenced by theobjectHandleparameter.#include <normApi.h> unsigned shortNormObjectGetInfo(NormObjectHandleobjectHandle, char* buffer, - unsigned short bufferLen);This function copies any
NORM_INFOcontent associated (by the sender application) with the transport object specified byobjectHandleinto the provided memory space referenced by the buffer parameter. ThebufferLenparameter indicates the length of the buffer space in bytes. If the providedbufferLenis less than the actualNORM_INFOlength, a partial copy will occur. The actual length ofNORM_INFOcontent available for the specified object is returned. However, note that until aNORM_RX_OBJECT_INFOnotification is posted to the receive application, noNORM_INFOcontent is available and a zero result will be returned, even ifNORM_INFOcontent may be subsequently available. TheNormObjectHasInfo()call can be used to determine if anyNORM_INFOcontent will ever be available for a specified transport object (i.e., determine if the sender has associated anyNORM_INFOwith the object in question).The actual length of currently available
NORM_INFOcontent for the specified transport object is returned. This function can be used to determine the length ofNORM_INFOcontent for the object even if a NULL buffer value and zerobufferLenis provided. A zero value is returned ifNORM_INFOcontent has not yet been received (or is non-existent) for the specified object.This function copies any
NORM_INFOcontent associated (by the sender application) with the transport object specified byobjectHandleinto the provided memory space referenced by the buffer parameter. ThebufferLenparameter indicates the length of the buffer space in bytes. If the providedbufferLenis less than the actualNORM_INFOlength, a partial copy will occur. The actual length ofNORM_INFOcontent available for the specified object is returned. However, note that until aNORM_RX_OBJECT_INFOnotification is posted to the receive application, noNORM_INFOcontent is available and a zero result will be returned, even ifNORM_INFOcontent may be subsequently available. TheNormObjectHasInfo()call can be used to determine if anyNORM_INFOcontent will ever be available for a specified transport object (i.e., determine if the sender has associated anyNORM_INFOwith the object in question).The actual length of currently available
NORM_INFOcontent for the specified transport object is returned. This function can be used to determine the length ofNORM_INFOcontent for the object even if a NULL buffer value and zerobufferLenis provided. A zero value is returned ifNORM_INFOcontent has not yet been received (or is non-existent) for the specified object.#include <normApi.h> -NormSizeNormObjectGetSize(NormObjectHandleobjectHandle);This function can be used to determine the size (in bytes) of the transport object specified by the
objectHandleparameter. NORM can support large object sizes for theNORM_OBJECT_FILEtype, so typically the NORM library is built with any necessary, related macros defined such that operating system large file support is enabled (e.g., "#define" or equivalent). The_FILE_OFFSET_BITS64NormSizetype is defined accordingly, so the application should be built with the same large file support configuration.For objects of type
NORM_OBJECT_STREAM, the size returned here corresponds to the stream buffer size set by the sender application when opening the referenced stream object.#include <normApi.h> +NormSizeNormObjectGetSize(NormObjectHandleobjectHandle);This function can be used to determine the size (in bytes) of the transport object specified by the
objectHandleparameter. NORM can support large object sizes for theNORM_OBJECT_FILEtype, so typically the NORM library is built with any necessary, related macros defined such that operating system large file support is enabled (e.g., "#define" or equivalent). The_FILE_OFFSET_BITS64NormSizetype is defined accordingly, so the application should be built with the same large file support configuration.For objects of type
NORM_OBJECT_STREAM, the size returned here corresponds to the stream buffer size set by the sender application when opening the referenced stream object.#include <normApi.h> -NormSizeNormObjectGetBytesPending(NormObjectHandleobjectHandle);This function can be used to determine the progress of reception of the NORM transport object identified by the
objectHandleparameter. This function indicates the number of bytes that are pending reception (I.e., when the object is completely received, "bytes pending" will equal ZERO). This function is not necessarily applicable to objects of typeNORM_OBJECT_STREAMwhich do not have a finite size. Note it is possible that this function might also be useful to query the "transmit pending" status of sender objects, but it does not account for pending FEC repair transmissions and thus may not produce useful results for this purpose.#include <normApi.h> +NormSizeNormObjectGetBytesPending(NormObjectHandleobjectHandle);This function can be used to determine the progress of reception of the NORM transport object identified by the
objectHandleparameter. This function indicates the number of bytes that are pending reception (I.e., when the object is completely received, "bytes pending" will equal ZERO). This function is not necessarily applicable to objects of typeNORM_OBJECT_STREAMwhich do not have a finite size. Note it is possible that this function might also be useful to query the "transmit pending" status of sender objects, but it does not account for pending FEC repair transmissions and thus may not produce useful results for this purpose.#include <normApi.h> -voidNormObjectCancel(NormObjectHandleobjectHandle);This function immediately cancels the transmission of a local sender transport object or the reception of a specified object from a remote sender as specified by the
objectHandleparameter. TheobjectHandlemust refer to a currently valid NORM transport object. Any resources used by the transport object in question are immediately freed unless the object has been otherwise retained by the application via theNormObjectRetain()call. Unless the application has retained the object in such fashion, the object in question should be considered invalid and the application must not again reference theobjectHandleafter this call is made.If the canceled object is a sender object not completely received by participating receivers, the receivers will be informed of the object's cancellation via the NORM protocol
NORM_CMD(SQUELCH) message in response to any NACKs requesting repair or retransmission of the applicable object. In the case of receive objects, the NORM receiver will not make further requests for repair of the indicated object, but furthermore, will acknowledge the object as completed with respect to any associated positive acknowledgement requests (seeNormSetWatermark()).#include <normApi.h> +voidNormObjectCancel(NormObjectHandleobjectHandle);This function immediately cancels the transmission of a local sender transport object or the reception of a specified object from a remote sender as specified by the
objectHandleparameter. TheobjectHandlemust refer to a currently valid NORM transport object. Any resources used by the transport object in question are immediately freed unless the object has been otherwise retained by the application via theNormObjectRetain()call. Unless the application has retained the object in such fashion, the object in question should be considered invalid and the application must not again reference theobjectHandleafter this call is made.If the canceled object is a sender object not completely received by participating receivers, the receivers will be informed of the object's cancellation via the NORM protocol
NORM_CMD(SQUELCH) message in response to any NACKs requesting repair or retransmission of the applicable object. In the case of receive objects, the NORM receiver will not make further requests for repair of the indicated object, but furthermore, will acknowledge the object as completed with respect to any associated positive acknowledgement requests (seeNormSetWatermark()).#include <normApi.h> -voidNormObjectRetain(NormObjectHandleobjectHandle);This function "retains" the
objectHandleand any state associated with it for further use by the application even when the NORM protocol engine may no longer require access to the associated transport object. Normally, the application is guaranteed that a givenNormObjectHandleis valid only while it is being actively transported by NORM (i.e., for sender objects, from the time an object is created by the application until it is canceled by the application or purged (see theNORM_TX_OBJECT_PURGEDnotification) by the protocol engine, or, for receiver objects, from the time of the object'sNORM_RX_OBJECT_NEWnotification until its reception is canceled by the application or aNORM_RX_OBJECT_COMPLETEDorNORM_RX_OBJECT_ABORTEDnotification is posted). Note that an application may refer to a given object after any related notification until the application makes a subsequent call toNormGetNextEvent().When the application makes a call to
NormObjectRetain()for a givenobjectHandle, the application may use thatobjectHandlevalue in any NORM API calls until the application makes a call toNormObjectRelease()for the given object. Note that the application MUST make a corresponding call toNormObjectRelease()for each call it has made toNormObjectRetain()in order to free any system resources (i.e., memory) used by that object. Also note that retaining a receive object also automatically retains any state associated with theNormNodeHandlecorresponding to the remote sender of that receive object so that the application may use NORM node API calls for the value returned byNormObjectGetSender()as needed.#include <normApi.h> +voidNormObjectRetain(NormObjectHandleobjectHandle);This function "retains" the
objectHandleand any state associated with it for further use by the application even when the NORM protocol engine may no longer require access to the associated transport object. Normally, the application is guaranteed that a givenNormObjectHandleis valid only while it is being actively transported by NORM (i.e., for sender objects, from the time an object is created by the application until it is canceled by the application or purged (see theNORM_TX_OBJECT_PURGEDnotification) by the protocol engine, or, for receiver objects, from the time of the object'sNORM_RX_OBJECT_NEWnotification until its reception is canceled by the application or aNORM_RX_OBJECT_COMPLETEDorNORM_RX_OBJECT_ABORTEDnotification is posted). Note that an application may refer to a given object after any related notification until the application makes a subsequent call toNormGetNextEvent().When the application makes a call to
NormObjectRetain()for a givenobjectHandle, the application may use thatobjectHandlevalue in any NORM API calls until the application makes a call toNormObjectRelease()for the given object. Note that the application MUST make a corresponding call toNormObjectRelease()for each call it has made toNormObjectRetain()in order to free any system resources (i.e., memory) used by that object. Also note that retaining a receive object also automatically retains any state associated with theNormNodeHandlecorresponding to the remote sender of that receive object so that the application may use NORM node API calls for the value returned byNormObjectGetSender()as needed.#include <normApi.h> -voidNormObjectRelease(NormObjectHandleobjectHandle);This function complements the
NormObjectRetain()call by immediately freeing any resources associated with the givenobjectHandle, assuming the underlying NORM protocol engine no longer requires access to the corresponding transport object. Note the NORM protocol engine retains/releases state for associated objects for its own needs and thus it is very unsafe for an application to callNormObjectRelease()for anobjectHandlefor which it has not previously explicitly retained viaNormObjectRetain().#include <normApi.h> +voidNormObjectRelease(NormObjectHandleobjectHandle);This function complements the
NormObjectRetain()call by immediately freeing any resources associated with the givenobjectHandle, assuming the underlying NORM protocol engine no longer requires access to the corresponding transport object. Note the NORM protocol engine retains/releases state for associated objects for its own needs and thus it is very unsafe for an application to callNormObjectRelease()for anobjectHandlefor which it has not previously explicitly retained viaNormObjectRetain().#include <normApi.h> boolNormFileGetName(NormObjectHandleobjectHandle, char* nameBuffer, - unsigned int bufferLen);This function copies the name, as a
NULL-terminated string, of the file object specified by theobjectHandleparameter into thenameBufferof lengthbufferLenbytes provided by the application. TheobjectHandleparameter must refer to a validNormObjectHandlefor an object of typeNORM_OBJECT_FILE. If the actual name is longer than the providedbufferLen, a partial copy will occur. Note that the file name consists of the entire path name of the specified file object and the application should give consideration to operating system file path lengths when providing thenameBuffer.This function copies the name, as a
NULL-terminated string, of the file object specified by theobjectHandleparameter into thenameBufferof lengthbufferLenbytes provided by the application. TheobjectHandleparameter must refer to a validNormObjectHandlefor an object of typeNORM_OBJECT_FILE. If the actual name is longer than the providedbufferLen, a partial copy will occur. Note that the file name consists of the entire path name of the specified file object and the application should give consideration to operating system file path lengths when providing thenameBuffer.#include <normApi.h> boolNormFileRename(NormObjectHandleobjectHandle, - const char* fileName);This function renames the file used to store content for the
NORM_OBJECT_FILEtransport object specified by theobjectHandleparameter. This allows receiver applications to rename (or move) received files as needed. NORM uses temporary file names for received files until the application explicitly renames the file. For example, sender applications may choose to use theNORM_INFOcontent associated with a file object to provide name and/or typing information to receivers. ThefileNameparameter must be aNULL-terminated string which should specify the full desired path name to be used. NORM will attempt to create sub-directories as needed to satisfy the request. Note that existing files of the same name may be overwritten.This function returns true upon success and false upon failure. Possible failure conditions include the case where the
objectHandledoes not refer to an object of typeNORM_OBJECT_FILEand where NORM was unable to successfully create any needed directories and/or the file itself.This function renames the file used to store content for the
NORM_OBJECT_FILEtransport object specified by theobjectHandleparameter. This allows receiver applications to rename (or move) received files as needed. NORM uses temporary file names for received files until the application explicitly renames the file. For example, sender applications may choose to use theNORM_INFOcontent associated with a file object to provide name and/or typing information to receivers. ThefileNameparameter must be aNULL-terminated string which should specify the full desired path name to be used. NORM will attempt to create sub-directories as needed to satisfy the request. Note that existing files of the same name may be overwritten.This function returns true upon success and false upon failure. Possible failure conditions include the case where the
objectHandledoes not refer to an object of typeNORM_OBJECT_FILEand where NORM was unable to successfully create any needed directories and/or the file itself.#include <normApi.h> -const char*NormDataAccessData(NormObjectHandleobjectHandle);This function allows the application to access the data storage area associated with a transport object of type
NORM_OBJECT_DATA. For example, the application may use this function to copy the received data content for its own use. Alternatively, the application may establish "ownership" for the allocated memory space using theNormDataDetachData()function if it is desired to avoid the copy.If the object specified by the
objectHandleparameter has no data content (or is not of typeNORM_OBJECT_DATA), a NULL value may be returned. The application MUST NOT attempt to modify the memory space used byNORM_OBJECT_DATAobjects during the time an associatedobjectHandleis valid. The length of data storage area can be determined with a call toNormObjectGetSize()for the sameobjectHandlevalue.#include <normApi.h> +const char*NormDataAccessData(NormObjectHandleobjectHandle);This function allows the application to access the data storage area associated with a transport object of type
NORM_OBJECT_DATA. For example, the application may use this function to copy the received data content for its own use. Alternatively, the application may establish "ownership" for the allocated memory space using theNormDataDetachData()function if it is desired to avoid the copy.If the object specified by the
objectHandleparameter has no data content (or is not of typeNORM_OBJECT_DATA), a NULL value may be returned. The application MUST NOT attempt to modify the memory space used byNORM_OBJECT_DATAobjects during the time an associatedobjectHandleis valid. The length of data storage area can be determined with a call toNormObjectGetSize()for the sameobjectHandlevalue.#include <normApi.h> -char*NormDataDetachData(NormObjectHandleobjectHandle);This function allows the application to disassociate data storage allocated by the NORM protocol engine for a receive object from the
NORM_OBJECT_DATAtransport object specified by theobjectHandleparameter. It is important that this function is called after the NORM protocol engine has indicated it is finished with the data object (i.e., after aNORM_TX_OBJECT_PURGED,NORM_RX_OBJECT_COMPLETED, orNORM_RX_OBJECT_ABORTEDnotification event). But the application must callNormDataDetachData()before a call is made toNormObjectCancel()orNormObjectRelease()for the object if it plans to access the data content afterwards. Otherwise, the NORM protocol engine will free the applicable memory space when the associatedNORM_OBJECT_DATAtransport object is deleted and the application will be unable to access the received data unless it has previously copied the content.Once the application has used this call to "detach" the data content, it is the application's responsibility to subsequently free the data storage space as needed.
#include <normApi.h> +char*NormDataDetachData(NormObjectHandleobjectHandle);This function allows the application to disassociate data storage allocated by the NORM protocol engine for a receive object from the
NORM_OBJECT_DATAtransport object specified by theobjectHandleparameter. It is important that this function is called after the NORM protocol engine has indicated it is finished with the data object (i.e., after aNORM_TX_OBJECT_PURGED,NORM_RX_OBJECT_COMPLETED, orNORM_RX_OBJECT_ABORTEDnotification event). But the application must callNormDataDetachData()before a call is made toNormObjectCancel()orNormObjectRelease()for the object if it plans to access the data content afterwards. Otherwise, the NORM protocol engine will free the applicable memory space when the associatedNORM_OBJECT_DATAtransport object is deleted and the application will be unable to access the received data unless it has previously copied the content.Once the application has used this call to "detach" the data content, it is the application's responsibility to subsequently free the data storage space as needed.
#include <normApi.h> -NormNodeHandleNormObjectGetSender(NormObjectHandleobjectHandle);This function retrieves the
NormNodeHandlecorresponding to the remote sender of the transport object associated with the givenobjectHandleparameter. Note that the returnedNormNodeHandlevalue is only valid for the same period that theobjectHandleis valid. The returnedNormNodeHandlemay optionally be retained for further use by the application using theNormNodeRetain()function call. The returned value can be used in the NORM Node Functions described later in this document.This function returns the
NormNodeHandlecorresponding to the remote sender of the transport object associated with the givenobjectHandleparameter. A value ofNORM_NODE_INVALIDis returned if the specifiedobjectHandlereferences a locally originated, sender object.The functions described in this section may be used for NORM sender or receiver (most typically receiver) purposes to retrieve additional information about a remote NormNode, given a valid
NormNodeHandle. Note that, unless specifically retained (seeNormNodeRetain()), aNormNodeHandleprovided in aNormEventnotification should be considered valid only until a subsequent call toNormGetNextEvent()is made.NormNodeHandlevalues retrieved usingNormObjectGetSender()can be considered valid for the same period of time as the correspondingNormObjectHandleis valid.#include <normApi.h> +NormNodeHandleNormObjectGetSender(NormObjectHandleobjectHandle);This function retrieves the
NormNodeHandlecorresponding to the remote sender of the transport object associated with the givenobjectHandleparameter. Note that the returnedNormNodeHandlevalue is only valid for the same period that theobjectHandleis valid. The returnedNormNodeHandlemay optionally be retained for further use by the application using theNormNodeRetain()function call. The returned value can be used in the NORM Node Functions described later in this document.This function returns the
NormNodeHandlecorresponding to the remote sender of the transport object associated with the givenobjectHandleparameter. A value ofNORM_NODE_INVALIDis returned if the specifiedobjectHandlereferences a locally originated, sender object.The functions described in this section may be used for NORM sender or receiver (most typically receiver) purposes to retrieve additional information about a remote NormNode, given a valid
NormNodeHandle. Note that, unless specifically retained (seeNormNodeRetain()), aNormNodeHandleprovided in aNormEventnotification should be considered valid only until a subsequent call toNormGetNextEvent()is made.NormNodeHandlevalues retrieved usingNormObjectGetSender()can be considered valid for the same period of time as the correspondingNormObjectHandleis valid.#include <normApi.h> -NormNodeIdNormNodeGetId(NormNodeHandlenodeHandle);This function retrieves the
NormNodeIdidentifier for the remote participant referenced by the givennodeHandlevalue. TheNormNodeIdis a 32-bit value used within the NORM protocol to uniquely identify participants within a NORM session. The participants identifiers are assigned by the application or derived (by the NORM API code) from the host computers default IP address.This function returns the
NormNodeIdvalue associated with the specifiednodeHandle. In the casenodeHandleis equal toNORM_NODE_INVALID, the return value will beNORM_NODE_NONE.#include <normApi.h> +NormNodeIdNormNodeGetId(NormNodeHandlenodeHandle);This function retrieves the
NormNodeIdidentifier for the remote participant referenced by the givennodeHandlevalue. TheNormNodeIdis a 32-bit value used within the NORM protocol to uniquely identify participants within a NORM session. The participants identifiers are assigned by the application or derived (by the NORM API code) from the host computers default IP address.This function returns the
NormNodeIdvalue associated with the specifiednodeHandle. In the casenodeHandleis equal toNORM_NODE_INVALID, the return value will beNORM_NODE_NONE.#include <normApi.h> boolNormNodeGetAddress(NormNodeHandlenodeHandle, char* addrBuffer, unsigned int* bufferLen, - unsigned short* port = NULL);This function retrieves the current network source address detected for packets received from remote NORM sender referenced by the
nodeHandleparameter. TheaddrBuffermust be a pointer to storage ofbufferLenbytes in length in which the referenced sender node's address will be returned. Optionally, the remote sender source port number (seeNormSetTxPort()) is also returned if the optional port pointer to storage parameter is provided in the call. Note that in the case of Network Address Translation (NAT) or other firewall activities, the source address detected by the NORM receiver may not be the original address of the original NORM sender.This function retrieves the current network source address detected for packets received from remote NORM sender referenced by the
nodeHandleparameter. TheaddrBuffermust be a pointer to storage ofbufferLenbytes in length in which the referenced sender node's address will be returned. Optionally, the remote sender source port number (seeNormSetTxPort()) is also returned if the optional port pointer to storage parameter is provided in the call. Note that in the case of Network Address Translation (NAT) or other firewall activities, the source address detected by the NORM receiver may not be the original address of the original NORM sender.#include <normApi.h> -doubleNormNodeGetId(NormNodeHandlenodeHandle);This function retrieves the advertised estimate of group round-trip timing (GRTT) for the remote sender referenced by the given
nodeHandlevalue. Newly-starting senders that have been participating as a receiver within a group may wish to use this function to provide a more accurate startup estimate of GRTT (seeNormSetGrttEstimate()) prior to a call toNormStartSender(). Applications may use this information for other purpose as well. Note that theNORM_GRTT_UPDATEDevent is posted (seeNormGetNextEvent()) by the NORM protocol engine to indicate when changes in the local sender or remote senders' GRTT estimate occurs.#include <normApi.h> +doubleNormNodeGetId(NormNodeHandlenodeHandle);This function retrieves the advertised estimate of group round-trip timing (GRTT) for the remote sender referenced by the given
nodeHandlevalue. Newly-starting senders that have been participating as a receiver within a group may wish to use this function to provide a more accurate startup estimate of GRTT (seeNormSetGrttEstimate()) prior to a call toNormStartSender(). Applications may use this information for other purpose as well. Note that theNORM_GRTT_UPDATEDevent is posted (seeNormGetNextEvent()) by the NORM protocol engine to indicate when changes in the local sender or remote senders' GRTT estimate occurs.#include <normApi.h> boolNormNodeGetCommand(NormNodeHandlenodeHandle, char* buffer, - unsigned int* buflen);This function retrieves the content of an application-defined command that was received from a remote sender associated with the given
nodeHandle. This call should be made in response to theNORM_RX_CMD_NEWnotification. This notification is issued for each command received. However the application may use this call to poll for received commands if desired. Additionally, the received command length can be "queried" by setting the value referenced by thebuflenparameter toZERO. Upon return, this value referenced by thebuflenparameter is adjusted to reflect the command length. Then a subsequent call toNormNodeGetCommand()can be made with an appropriately-sized buffer to retrieve the received command content. The command size will be less than or equal to the NORM segment size configured for the given remote sender.Note that if a rapid succession of commands are sent it is possible that the commands may be delivered to the receivers out-of-order. Also, when repetition is requested (i.e., if
robustis set totrue) the receiver may receive duplicate copies of the same command. It is up to the application to provide any needed mechanism for detecting and/or filtering duplicate command reception.This function returns
trueupon successful retrieval of command content. A return value offalseindicates that either no command was available or the provided buffer size (buflenparameter) was inadequate. The value referenced by thebuflenparameter is adjusted to indicate the actual command length (in bytes) upon return.This function retrieves the content of an application-defined command that was received from a remote sender associated with the given
nodeHandle. This call should be made in response to theNORM_RX_CMD_NEWnotification. This notification is issued for each command received. However the application may use this call to poll for received commands if desired. Additionally, the received command length can be "queried" by setting the value referenced by thebuflenparameter toZERO. Upon return, this value referenced by thebuflenparameter is adjusted to reflect the command length. Then a subsequent call toNormNodeGetCommand()can be made with an appropriately-sized buffer to retrieve the received command content. The command size will be less than or equal to the NORM segment size configured for the given remote sender.Note that if a rapid succession of commands are sent it is possible that the commands may be delivered to the receivers out-of-order. Also, when repetition is requested (i.e., if
robustis set totrue) the receiver may receive duplicate copies of the same command. It is up to the application to provide any needed mechanism for detecting and/or filtering duplicate command reception.This function returns
trueupon successful retrieval of command content. A return value offalseindicates that either no command was available or the provided buffer size (buflenparameter) was inadequate. The value referenced by thebuflenparameter is adjusted to indicate the actual command length (in bytes) upon return.#include <normApi.h> -voidNormNodeFreeBuffers(NormNodeHandlenodeHandle);This function releases memory resources that were allocated for a remote sender. For example, the receiver application may wish to free memory resources when receiving a
NORM_REMOTE_SENDER_INACTIVEnotification for a given remote sender when multiple senders may be providing content. The NORM protocol engine allocates memory for reliable transport buffering on a per sender basis according to the limit set in theNormStartReceiver()call. These buffering resources comprise the majority of the state allocated for a given remote sender. For NORM applications with possibly multiple senders active at different times, this function can be used to manage to amount of memory allocated for reliable reception. If a sender becomes "active" again after a call toNormNodeFreeBuffers(), new memory resources will be allocated. Note that state for any pending (uncompleted) objects will be dropped when this function is called and the receiver may request retransmission and repair of content if the sender once again becomes "active". The application SHOULD callNormObjectCancel()for any pending objects before callingNormNodeFreeBuffers()if it wishes to never receive those pending objects. Alternatively, a call toNormNodeDelete()will completely eliminate all state for a given remote sender and, if that sender becomes "active" again, it will be treated as a completely new sender.#include <normApi.h> +voidNormNodeFreeBuffers(NormNodeHandlenodeHandle);This function releases memory resources that were allocated for a remote sender. For example, the receiver application may wish to free memory resources when receiving a
NORM_REMOTE_SENDER_INACTIVEnotification for a given remote sender when multiple senders may be providing content. The NORM protocol engine allocates memory for reliable transport buffering on a per sender basis according to the limit set in theNormStartReceiver()call. These buffering resources comprise the majority of the state allocated for a given remote sender. For NORM applications with possibly multiple senders active at different times, this function can be used to manage to amount of memory allocated for reliable reception. If a sender becomes "active" again after a call toNormNodeFreeBuffers(), new memory resources will be allocated. Note that state for any pending (uncompleted) objects will be dropped when this function is called and the receiver may request retransmission and repair of content if the sender once again becomes "active". The application SHOULD callNormObjectCancel()for any pending objects before callingNormNodeFreeBuffers()if it wishes to never receive those pending objects. Alternatively, a call toNormNodeDelete()will completely eliminate all state for a given remote sender and, if that sender becomes "active" again, it will be treated as a completely new sender.#include <normApi.h> -voidNormNodeDelete(NormNodeHandlenodeHandle);This function can be used by a NORM receiver application to completely remove the state associated with a remote sender for the given
nodeHandle. For example, when aNORM_REMOTE_SENDER_INACTIVEnotification occurs for a given sender, the application may wish to completely free all associated resources. Note this is distinct from theNormNodeFreeBuffers()call where only the buffering resources are freed and other state pertaining to the sender is kept. If the deleted sender again becomes "active", it will be treated as a brand new sender. Unless explicitly retained with a call toNormNodeRetain(), thenodeHandleshould be considered invalid after this call is made. Additionally, any NormObjectHandle values for pending objects from this sender are also invalidated (unless otherwise retained), althoughNORM_RX_OBJECT_ABORTEDnotifications may be issued for those pending objects.#include <normApi.h> +voidNormNodeDelete(NormNodeHandlenodeHandle);This function can be used by a NORM receiver application to completely remove the state associated with a remote sender for the given
nodeHandle. For example, when aNORM_REMOTE_SENDER_INACTIVEnotification occurs for a given sender, the application may wish to completely free all associated resources. Note this is distinct from theNormNodeFreeBuffers()call where only the buffering resources are freed and other state pertaining to the sender is kept. If the deleted sender again becomes "active", it will be treated as a brand new sender. Unless explicitly retained with a call toNormNodeRetain(), thenodeHandleshould be considered invalid after this call is made. Additionally, any NormObjectHandle values for pending objects from this sender are also invalidated (unless otherwise retained), althoughNORM_RX_OBJECT_ABORTEDnotifications may be issued for those pending objects.#include <normApi.h> -voidNormNodeRetain(NormNodeHandlenodeHandle);In the same manner as the
NormObjectRetain()function, this function allows the application to retain state associated with a givennodeHandlevalue even when the underlying NORM protocol engine might normally free the associated state and thus invalidate theNormNodeHandle. If the application uses this function, it must make a corresponding call toNormNodeRelease()when finished with the node information to avoid a memory leak condition.NormNodeHandlevalues (unless retained) are valid from the time of aNORM_REMOTE_SENDER_NEWnotification until a complimentaryNORM_REMOTE_SENDER_PURGEDnotification. During that interval, the application will receiveNORM_REMOTE_SENDER_ACTIVEandNORM_REMOTE_SENDER_INACTIVEnotifications according to the sender's message transmission activity within the session.It is important to note that, if the NORM protocol engine posts a
NORM_REMOTE_SENDER_PURGEDnotification for a givenNormNodeHandle, the NORM protocol engine could possibly, subsequently establish a new, differentNormNodeHandlevalue for the same remote sender (i.e., one of equivalentNormNodeId) if it again becomes active in the session. A newNormNodeHandlemay likely be established even if the application has retained the previousNormNodeHandlevalue. Therefore, to the application, it might appear that two different senders with the sameNormNodeIdare participating if these notifications are not carefully monitored. This behavior is contingent upon how the application has configured the NORM protocol engine to manage resources when there is potential for a large number of remote senders within a session (related APIs are TBD). For example, the application may wish to control which specific remote senders for which it keeps state (or limit the memory resources used for remote sender state, etc) and the NORM API may be extended in the future to control this behavior.#include <normApi.h> +voidNormNodeRetain(NormNodeHandlenodeHandle);In the same manner as the
NormObjectRetain()function, this function allows the application to retain state associated with a givennodeHandlevalue even when the underlying NORM protocol engine might normally free the associated state and thus invalidate theNormNodeHandle. If the application uses this function, it must make a corresponding call toNormNodeRelease()when finished with the node information to avoid a memory leak condition.NormNodeHandlevalues (unless retained) are valid from the time of aNORM_REMOTE_SENDER_NEWnotification until a complimentaryNORM_REMOTE_SENDER_PURGEDnotification. During that interval, the application will receiveNORM_REMOTE_SENDER_ACTIVEandNORM_REMOTE_SENDER_INACTIVEnotifications according to the sender's message transmission activity within the session.It is important to note that, if the NORM protocol engine posts a
NORM_REMOTE_SENDER_PURGEDnotification for a givenNormNodeHandle, the NORM protocol engine could possibly, subsequently establish a new, differentNormNodeHandlevalue for the same remote sender (i.e., one of equivalentNormNodeId) if it again becomes active in the session. A newNormNodeHandlemay likely be established even if the application has retained the previousNormNodeHandlevalue. Therefore, to the application, it might appear that two different senders with the sameNormNodeIdare participating if these notifications are not carefully monitored. This behavior is contingent upon how the application has configured the NORM protocol engine to manage resources when there is potential for a large number of remote senders within a session (related APIs are TBD). For example, the application may wish to control which specific remote senders for which it keeps state (or limit the memory resources used for remote sender state, etc) and the NORM API may be extended in the future to control this behavior.#include <normApi.h> -voidNormNodeRelease(NormNodeHandlenodeHandle);In complement to the
NormNodeRetain()function, this API call releases the specifiednodeHandleso that the NORM protocol engine may free associated resources as needed. Once this call is made, the application should no longer reference the specifiedNormNodeHandle, unless it is still valid.This section describes some additional function calls that are available to set debugging output options and control other aspects of the NORM implementation.
#include <normApi.h> +voidNormNodeRelease(NormNodeHandlenodeHandle);In complement to the
NormNodeRetain()function, this API call releases the specifiednodeHandleso that the NORM protocol engine may free associated resources as needed. Once this call is made, the application should no longer reference the specifiedNormNodeHandle, unless it is still valid.This section describes some additional function calls that are available to set debugging output options and control other aspects of the NORM implementation.
#include <normApi.h> -voidNormSetDebugLevel(unsigned int level);This function controls the verbosity of NORM debugging output. Higher values of level result in more detailed output. The highest level of debugging is 12. The debug output consists of text written to STDOUT by default but may be directed to a log file using the
NormOpenDebugLog()function.#include <normApi.h> +voidNormSetDebugLevel(unsigned int level);This function controls the verbosity of NORM debugging output. Higher values of level result in more detailed output. The highest level of debugging is 12. The debug output consists of text written to STDOUT by default but may be directed to a log file using the
NormOpenDebugLog()function.#include <normApi.h> -boolNormOpenDebugLog(NormInstanceHandle instance, const char* fileName);This function allows NORM debug output to be directed to a file instead of the default
STDERR.#include <normApi.h> +boolNormOpenDebugLog(NormInstanceHandle instance, const char* fileName);This function allows NORM debug output to be directed to a file instead of the default
STDERR.#include <normApi.h> -boolNormCloseDebugLog(NormInstanceHandle instance);#include <normApi.h> +boolNormCloseDebugLog(NormInstanceHandle instance);#include <normApi.h> -boolNormOpenDebugPipe(NormInstanceHandle instance, const char* pipeName);#include <normApi.h> +boolNormOpenDebugPipe(NormInstanceHandle instance, const char* pipeName);#include <normApi.h> -boolNormCloseDebugPipe(NormInstanceHandle instance);
NormCloseDebugPipe(NormInstanceHandle instance);