v1.3b4
parent
14d4ab80c6
commit
32c42ee9c0
|
|
@ -6,7 +6,7 @@
|
|||
<META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)">
|
||||
<META NAME="AUTHOR" CONTENT="Robert Adamson">
|
||||
<META NAME="CREATED" CONTENT="20040824;15180000">
|
||||
<META NAME="CHANGED" CONTENT="20050609;13321500">
|
||||
<META NAME="CHANGED" CONTENT="20050621;14191600">
|
||||
<META NAME="DESCRIPTION" CONTENT="NORM Object Functions 42
NORM Object Functions
NORM_OBJECT_STREAM
NORM Sender Functions 19
NORM Sender Functions
">
|
||||
<META NAME="KEYWORDS" CONTENT="norm object value application function ">
|
||||
<STYLE>
|
||||
|
|
@ -99,6 +99,8 @@ communication needs.</P>
|
|||
<H1 CLASS="western" ALIGN=CENTER STYLE="page-break-before: always">Table
|
||||
of Contents</H1>
|
||||
<DIV ID="Table of Contents1" DIR="LTR">
|
||||
<P STYLE="margin-top: 0.25in; font-style: normal"><BR>
|
||||
</P>
|
||||
<P STYLE="margin-top: 0.25in; font-style: normal"><FONT FACE="Helvetica, sans-serif"><B>Overview</B></FONT></P>
|
||||
<P STYLE="margin-top: 0.17in; font-style: normal"><FONT SIZE=2><B>API
|
||||
Initialization</B></FONT></P>
|
||||
|
|
@ -161,6 +163,7 @@ of Contents</H1>
|
|||
<P STYLE="margin-left: 0.17in; margin-top: 0in; font-style: normal"><FONT SIZE=2><A HREF="#NormSetTxSocketBuffer()">NormSetTxSocketBuffer()</A></FONT></P>
|
||||
<P STYLE="margin-left: 0.17in; margin-top: 0in; font-style: normal"><FONT SIZE=2><A HREF="#NormSetCongestionControl()">NormSetCongestionControl()</A></FONT></P>
|
||||
<P STYLE="margin-left: 0.17in; margin-top: 0in; font-style: normal"><FONT SIZE=2><A HREF="#NormSetTransmitRateBounds()">NormSetTransmitRateBounds()</A></FONT></P>
|
||||
<P STYLE="margin-left: 0.17in; margin-top: 0in; font-style: normal"><FONT SIZE=2><A HREF="#NormSetTransmitCacheBounds()">NormSetTransmitCacheBounds()</A></FONT></P>
|
||||
<P STYLE="margin-left: 0.17in; margin-top: 0in; font-style: normal"><FONT SIZE=2><A HREF="#NormSetAutoParity()">NormSetAutoParity()</A></FONT></P>
|
||||
<P STYLE="margin-left: 0.17in; margin-top: 0in; font-style: normal"><FONT SIZE=2><A HREF="#NormSetGrttEstimate()">NormSetGrttEstimate()</A></FONT></P>
|
||||
<P STYLE="margin-left: 0.17in; margin-top: 0in; font-style: normal"><FONT SIZE=2><A HREF="#NormAddAckingNode()">NormAddAckingNode()</A></FONT></P>
|
||||
|
|
@ -400,7 +403,7 @@ 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
|
||||
Protocol Prototyping toolkit "Protokit" library (a.k.a
|
||||
"Protolib") (static library files "libProtokit.a"
|
||||
for Unix and "Protokit.lib" for Win32). Depending upon the
|
||||
platform, some additional library dependencies may be required to
|
||||
|
|
@ -420,13 +423,22 @@ same. With NORM, it is recommended that "large file support"
|
|||
options be enabled when possible.</P>
|
||||
<P CLASS="western" STYLE="font-style: normal">The NORM API uses
|
||||
threading so that the NORM protocol engine may run independent of the
|
||||
application. Thus the "Posix Threads" library must be
|
||||
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 ("-ldl –lnsl –lsocket –lresolv")
|
||||
to achieve successful compilation. The Makefiles in the NORM source
|
||||
code distribution are a reference for these requirements.</P>
|
||||
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.</P>
|
||||
<P CLASS="western" STYLE="font-style: normal">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 <FONT FACE="Courier"><A HREF="#NormSize">NormSize</A></FONT>
|
||||
type in "normApi.h" depends upon this compilation flag).</P>
|
||||
<H2 CLASS="western">Win32/WiNCE Platforms</H2>
|
||||
<P CLASS="western" STYLE="font-style: normal">NORM has been built
|
||||
using Microsoft's Visual C++ (6.0 and .NET) and Embedded VC++ 4.2
|
||||
|
|
@ -815,10 +827,11 @@ function call.</P>
|
|||
refer to the transport object identified by the event's "object'
|
||||
field. Typically, this will occur when the application has
|
||||
enqueued more objects than space available within the set sender
|
||||
transmit cache bounds. Posting of this notification means the
|
||||
application is free to free any resources (memory, files, etc)
|
||||
associated with the indicated "object". After this
|
||||
event, the given "object" handle (<FONT FACE="Courier"><A HREF="#NormObjectHandle">NormObjectHandle</A></FONT>)
|
||||
transmit cache bounds (see <FONT FACE="Courier"><A HREF="#NormSetTransmitCacheBounds()">NormSetTransmitCacheBounds()</A></FONT>).
|
||||
Posting of this notification means the application is free to
|
||||
free any resources (memory, files, etc) associated with the
|
||||
indicated "object". After this event, the given
|
||||
"object" handle (<FONT FACE="Courier"><A HREF="#NormObjectHandle">NormObjectHandle</A></FONT>)
|
||||
is no longer valid unless it is specifically retained by the
|
||||
application.</P>
|
||||
</TD>
|
||||
|
|
@ -1645,7 +1658,7 @@ with no lower bound. These rate bounds apply only when congestion
|
|||
control operation is enabled (see<FONT FACE="Courier">
|
||||
<A HREF="#NormSetCongestionControl()">NormSetCongestionControl()</A></FONT>). If the current congestion
|
||||
control rate falls outside of the specified bounds, the sender
|
||||
transmission rate will</P>
|
||||
transmission rate will be adjusted to stay within the set bounds.</P>
|
||||
<H4 CLASS="western">Return Values</H4>
|
||||
<P CLASS="western" STYLE="font-style: normal">This function returns
|
||||
<FONT FACE="Courier"><I>true</I></FONT> upon success. If both
|
||||
|
|
@ -1653,6 +1666,69 @@ transmission rate will</P>
|
|||
are greater than or equal to zero, but (<FONT FACE="Courier"><U>rateMax</U></FONT>
|
||||
< <FONT FACE="Courier"><U>rateMin</U></FONT>), the rate bounds
|
||||
will remain unset or unchanged and the function will return <FONT FACE="Courier"><I>false</I></FONT>.</P>
|
||||
<H3 CLASS="functionheading-western"><A NAME="NormSetTransmitCacheBounds()">NormSetTransmitCacheBounds()</A></H3>
|
||||
<H4 CLASS="western">Synopsis</H4>
|
||||
<P STYLE="font-style: normal; page-break-after: avoid"><FONT FACE="Courier"><FONT SIZE=2>#include
|
||||
<normApi.h></FONT></FONT></P>
|
||||
<P STYLE="font-style: normal; page-break-after: avoid"><A NAME="OLE_LINK1"></A>
|
||||
<FONT FACE="Courier"><FONT SIZE=2>void
|
||||
NormSetTransmitCacheBounds(<A HREF="#NormSessionHandle">NormSessionHandle</A> session,
|
||||
<BR> <A HREF="#NormSize">NormSize</A> sizeMax,<BR> unsigned
|
||||
int countMin,<BR> unsigned
|
||||
int countMax);</FONT></FONT></P>
|
||||
<H4 CLASS="western">Description</H4>
|
||||
<P CLASS="western" STYLE="font-style: normal">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_EMPTY notifications. 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. A
|
||||
NORM_TX_OBJECT_PURGED notification 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.
|
||||
</P>
|
||||
<P CLASS="western" STYLE="font-style: normal">The <FONT FACE="Courier"><U>sizeMax</U></FONT>
|
||||
parameter sets the maximum total size, in bytes, of enqueued objects
|
||||
allowed, providing the constraints of the <FONT FACE="Courier"><U>countMin</U></FONT>
|
||||
and <FONT FACE="Courier"><U>countMax</U></FONT> parameters are met.
|
||||
The <FONT FACE="Courier"><U>countMin</U></FONT> parameter sets the
|
||||
minimum number of objects the application may enqueue, regardless of
|
||||
the objects' sizes and the <FONT FACE="Courier"><U>sizeMax</U></FONT>
|
||||
value. For example, the default <FONT FACE="Courier"><U>sizeMax</U></FONT>
|
||||
value is 20 Mbyte and the default <FONT FACE="Courier"><U>countMin</U></FONT>
|
||||
is 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, the <FONT FACE="Courier"><U>countMax</U></FONT>
|
||||
parameter sets a ceiling on how many objects may be enqueued,
|
||||
regardless of their total sizes with respect to the <FONT FACE="Courier"><U>sizeMax</U></FONT>
|
||||
setting. For example, the default <FONT FACE="Courier"><U>countMax</U></FONT>
|
||||
value 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. <I>Note that </I><FONT FACE="Courier"><U><I>countMax</I></U></FONT><I>
|
||||
must be greater than or equal to </I><FONT FACE="Courier"><U><I>countMin</I></U></FONT><I>
|
||||
and </I><FONT FACE="Courier"><U><I>countMin</I></U></FONT><I> is
|
||||
recommended to be at least two.</I></P>
|
||||
<P CLASS="western" STYLE="font-style: normal">Note that in the case
|
||||
of NORM_OBJECT_FILE objects, 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 the <FONT FACE="Courier"><U>countMax</U></FONT>
|
||||
value accordingly. In other cases, a large <FONT FACE="Courier"><U>countMin</U></FONT>
|
||||
or <FONT FACE="Courier"><U>countMax</U></FONT> may 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.</P>
|
||||
<H4 CLASS="western">Return Values</H4>
|
||||
<P CLASS="western" STYLE="font-style: normal">This function has no
|
||||
return value.</P>
|
||||
<H3 CLASS="functionheading-western"><A NAME="NormSetAutoParity()">NormSetAutoParity()</A></H3>
|
||||
<H4 CLASS="western">Synopsis</H4>
|
||||
<P STYLE="font-style: normal; page-break-after: avoid"><FONT FACE="Courier"><FONT SIZE=2>#include
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
10
VERSION.TXT
10
VERSION.TXT
|
|
@ -1,5 +1,15 @@
|
|||
NORM Version History
|
||||
|
||||
Version 1.3b4
|
||||
=============
|
||||
- Added NormSetTxCacheBounds(), see NormDevGuide for details
|
||||
- Fixed issue with NormStreamSeekMsgStart() that crept in
|
||||
somehow (Thanks to Jody Hagins for finding it).
|
||||
- Added code to check that NormFileEnqueue() argument is
|
||||
actually a file and not a directory name (Thanks to
|
||||
Charlie Shyr for finding this)
|
||||
- Fixed NormSession::Open() so that IPv6 works
|
||||
|
||||
Version 1.3b3
|
||||
=============
|
||||
- Added NORM_TX_FLUSH_COMPLETE notification so the sender app
|
||||
|
|
|
|||
|
|
@ -933,6 +933,21 @@ void NormSetTransmitRateBounds(NormSessionHandle sessionHandle,
|
|||
}
|
||||
} // end NormSetTransmitRateBounds()
|
||||
|
||||
void NormSetTransmitCacheBounds(NormSessionHandle sessionHandle,
|
||||
NormSize sizeMax,
|
||||
unsigned long countMin,
|
||||
unsigned long countMax)
|
||||
{
|
||||
NormInstance* instance = NormInstance::GetInstanceFromSession(sessionHandle);
|
||||
if (instance && instance->dispatcher.SuspendThread())
|
||||
{
|
||||
NormSession* session = (NormSession*)sessionHandle;
|
||||
NormObjectSize theSize(sizeMax);
|
||||
if (session) session->SetTxCacheBounds(theSize, countMin, countMax);
|
||||
instance->dispatcher.ResumeThread();
|
||||
}
|
||||
} // end NormSetTransmitCacheBounds()
|
||||
|
||||
void NormSetAutoParity(NormSessionHandle sessionHandle, unsigned char autoParity)
|
||||
{
|
||||
NormInstance* instance = NormInstance::GetInstanceFromSession(sessionHandle);
|
||||
|
|
|
|||
|
|
@ -171,7 +171,6 @@ void NormSetMessageTrace(NormSessionHandle sessionHandle, bool state);
|
|||
void NormSetTxLoss(NormSessionHandle sessionHandle, double percent);
|
||||
void NormSetRxLoss(NormSessionHandle sessionHandle, double percent);
|
||||
|
||||
|
||||
/** NORM Sender Functions */
|
||||
|
||||
bool NormStartSender(NormSessionHandle sessionHandle,
|
||||
|
|
@ -196,6 +195,11 @@ void NormSetTransmitRateBounds(NormSessionHandle sessionHandle,
|
|||
double rateMin,
|
||||
double rateMax);
|
||||
|
||||
void NormSetTransmitCacheBounds(NormSessionHandle sessionHandle,
|
||||
NormSize sizeMax,
|
||||
unsigned long countMin,
|
||||
unsigned long countMax);
|
||||
|
||||
void NormSetAutoParity(NormSessionHandle sessionHandle,
|
||||
unsigned char autoParity);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,11 +12,12 @@
|
|||
#ifdef UNIX
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h> // for "waitpid()"
|
||||
#include <signal.h>
|
||||
#else
|
||||
#ifndef _WIN32_WCE
|
||||
#include <io.h> // for _mktmp()
|
||||
#endif // _WIN32-WCE
|
||||
#endif // UNIX
|
||||
#endif // if/else UNIX/WIN32
|
||||
|
||||
// Command-line application using Protolib EventDispatcher
|
||||
class NormApp : public NormController, public ProtoApp
|
||||
|
|
@ -142,7 +143,7 @@ NormApp::NormApp()
|
|||
tx_buffer_size(1024*1024),
|
||||
tx_object_interval(0.0), tx_repeat_count(0), tx_repeat_interval(2.0), tx_repeat_clear(true),
|
||||
rx_buffer_size(1024*1024), rx_sock_buffer_size(0),
|
||||
rx_cache_path(NULL), unicast_nacks(false), silent_client(false),
|
||||
rx_cache_path(NULL), post_processor(NULL), unicast_nacks(false), silent_client(false),
|
||||
tracing(false), tx_loss(0.0), rx_loss(0.0)
|
||||
{
|
||||
|
||||
|
|
@ -166,7 +167,7 @@ NormApp::~NormApp()
|
|||
if (address) delete[] address;
|
||||
if (interface_name) delete[] interface_name;
|
||||
if (rx_cache_path) delete[] rx_cache_path;
|
||||
if (post_processor) delete[] post_processor;
|
||||
if (post_processor) delete post_processor;
|
||||
}
|
||||
|
||||
// NOTE on message flushing mode:
|
||||
|
|
@ -353,7 +354,7 @@ bool NormApp::OnCommand(const char* cmd, const char* val)
|
|||
len = strlen(buffer);
|
||||
len = (len > 8191) ? 8191 : len;
|
||||
buffer[len++] = '\0';
|
||||
if (!control_pipe.Send(buffer, (unsigned int)len))
|
||||
if (!control_pipe.Send(buffer, (unsigned int&)len))
|
||||
{
|
||||
DMSG(0, "NormApp::OnCommand() error sending command to remote instance\n");
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -214,7 +214,6 @@ void NormObject::Close()
|
|||
|
||||
NormObjectSize NormObject::GetBytesPending() const
|
||||
{
|
||||
NormObjectSize bytesCompleted;
|
||||
NormBlockId nextId;
|
||||
if (GetFirstPending(nextId))
|
||||
{
|
||||
|
|
@ -1796,7 +1795,7 @@ bool NormFileObject::Open(const char* thePath,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (file.Open(thePath, O_RDWR | O_CREAT | O_TRUNC))
|
||||
if (file.Open(thePath, O_WRONLY | O_CREAT | O_TRUNC))
|
||||
{
|
||||
file.Lock();
|
||||
}
|
||||
|
|
@ -1806,15 +1805,21 @@ bool NormFileObject::Open(const char* thePath,
|
|||
return false;
|
||||
}
|
||||
}
|
||||
//block_size = NormObjectSize(server->BlockSize()) *
|
||||
// NormObjectSize(server->SegmentSize());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Verify that it _is_ a file
|
||||
if (NormFile::NORMAL != NormFile::GetType(thePath))
|
||||
{
|
||||
DMSG(0, "NormFileObject::Open() send file \"%s\" is not a file "
|
||||
"(a directory perhaps?)\n", thePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// We're sending this file
|
||||
if (file.Open(thePath, O_RDONLY))
|
||||
{
|
||||
NormObjectSize::Offset size = file.GetSize();
|
||||
NormObjectSize::Offset size = file.GetSize();
|
||||
if (size)
|
||||
{
|
||||
if (!NormObject::Open(NormObjectSize(size),
|
||||
|
|
@ -2576,6 +2581,8 @@ bool NormStreamObject::WriteSegment(NormBlockId blockId,
|
|||
read_index.block = blockId;
|
||||
read_index.segment = segmentId;
|
||||
read_offset = segmentOffset;
|
||||
TRACE("norm stream read init read_index.segment:%hu read_offset:%lu\n",
|
||||
read_index.segment, read_offset);
|
||||
}
|
||||
|
||||
if ((blockId < read_index.block) ||
|
||||
|
|
@ -2742,13 +2749,16 @@ void NormStreamObject::Prune(NormBlockId blockId)
|
|||
} // end NormStreamObject::Prune()
|
||||
|
||||
// Sequential (in order) read/write routines (TBD) Add a "Seek()" method
|
||||
bool NormStreamObject::Read(char* buffer, unsigned int* buflen, bool findMsgStart)
|
||||
bool NormStreamObject::Read(char* buffer, unsigned int* buflen, bool seekMsgStart)
|
||||
{
|
||||
SetDebugLevel(4);
|
||||
TRACE("NormStreamObject::Read(seekMsgStart:%d) read_offset:%lu\n", seekMsgStart, read_offset);
|
||||
if (stream_closing)
|
||||
{
|
||||
DMSG(4, "NormStreamObject::Read() attempted to read from closed stream\n");
|
||||
*buflen = 0;
|
||||
return true;
|
||||
TRACE("return 1\n");
|
||||
return seekMsgStart ? false : true;
|
||||
}
|
||||
Retain();
|
||||
SetNotifyOnUpdate(true); // reset notification when streams are read
|
||||
|
|
@ -2756,14 +2766,16 @@ bool NormStreamObject::Read(char* buffer, unsigned int* buflen, bool findMsgStar
|
|||
unsigned int bytesToRead = *buflen;
|
||||
do
|
||||
{
|
||||
TRACE("do top ...\n");
|
||||
NormBlock* block = stream_buffer.Find(read_index.block);
|
||||
if (!block)
|
||||
{
|
||||
// DMSG(0, "NormStreamObject::Read() stream buffer empty (1) (sbEmpty:%d)\n", stream_buffer.IsEmpty());
|
||||
DMSG(0, "NormStreamObject::Read() stream buffer empty (1) (sbEmpty:%d)\n", stream_buffer.IsEmpty());
|
||||
*buflen = bytesRead;
|
||||
if (bytesRead > 0)
|
||||
{
|
||||
Release();
|
||||
TRACE("return 2\n");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
@ -2782,7 +2794,8 @@ bool NormStreamObject::Read(char* buffer, unsigned int* buflen, bool findMsgStar
|
|||
else
|
||||
{
|
||||
Release();
|
||||
return findMsgStart ? false : true;
|
||||
TRACE("return 3\n");
|
||||
return seekMsgStart ? false : true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2792,12 +2805,13 @@ bool NormStreamObject::Read(char* buffer, unsigned int* buflen, bool findMsgStar
|
|||
|
||||
if (!segment)
|
||||
{
|
||||
//DMSG(0, "NormStreamObject::Read(%lu:%hu) stream buffer empty (2)\n",
|
||||
// (UINT32)read_index.block, read_index.segment);
|
||||
DMSG(0, "NormStreamObject::Read(%lu:%hu) stream buffer empty (2)\n",
|
||||
(UINT32)read_index.block, read_index.segment);
|
||||
*buflen = bytesRead;
|
||||
if (bytesRead > 0)
|
||||
{
|
||||
Release();
|
||||
TRACE("return 4\n");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
@ -2819,7 +2833,8 @@ bool NormStreamObject::Read(char* buffer, unsigned int* buflen, bool findMsgStar
|
|||
else
|
||||
{
|
||||
Release();
|
||||
return findMsgStart ? false : true;
|
||||
TRACE("return 5\n");
|
||||
return seekMsgStart ? false : true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2855,7 +2870,7 @@ bool NormStreamObject::Read(char* buffer, unsigned int* buflen, bool findMsgStar
|
|||
UINT16 count = length - index;
|
||||
count = MIN(count, bytesToRead);
|
||||
|
||||
if (findMsgStart)
|
||||
if (seekMsgStart)
|
||||
{
|
||||
if ((0 != index) ||
|
||||
!NormDataMsg::StreamPayloadFlagIsSet(segment, NormDataMsg::FLAG_MSG_START))
|
||||
|
|
@ -2882,8 +2897,13 @@ bool NormStreamObject::Read(char* buffer, unsigned int* buflen, bool findMsgStar
|
|||
read_index.segment = 0;
|
||||
Prune(read_index.block);
|
||||
}
|
||||
TRACE("continue ...\n");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
seekMsgStart = false;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SIMULATE
|
||||
|
|
@ -2924,9 +2944,10 @@ bool NormStreamObject::Read(char* buffer, unsigned int* buflen, bool findMsgStar
|
|||
server->DeleteObject(this);
|
||||
}
|
||||
}
|
||||
} while (bytesToRead > 0); // end while (len > 0)
|
||||
} while ((bytesToRead > 0) || seekMsgStart); // end while (len > 0)
|
||||
*buflen = bytesRead;
|
||||
Release();
|
||||
TRACE("return 7\n");
|
||||
return true;
|
||||
} // end NormStreamObject::Read()
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ bool NormPostProcessor::SetCommand(const char* cmd)
|
|||
}
|
||||
|
||||
// 2) Count the number of tokens
|
||||
if (!cmd) return true; // post processing disabled
|
||||
if (NULL == cmd) return true; // post processing disabled
|
||||
if (!strcmp(cmd, "none")) return SetCommand(NULL);
|
||||
const char* ptr = cmd;
|
||||
unsigned int argCount = 0;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ bool NormSession::Open(const char* interfaceName)
|
|||
{
|
||||
if (address.GetPort() != tx_port)
|
||||
{
|
||||
if (!tx_socket->Open(tx_port))
|
||||
if (!tx_socket->Open(tx_port, address.GetType()))
|
||||
{
|
||||
DMSG(0, "NormSession::Open() tx_socket open error\n");
|
||||
return false;
|
||||
|
|
@ -107,7 +107,7 @@ bool NormSession::Open(const char* interfaceName)
|
|||
}
|
||||
if (!rx_socket.IsOpen())
|
||||
{
|
||||
if (!rx_socket.Open(address.GetPort()))
|
||||
if (!rx_socket.Open(address.GetPort(), address.GetType()))
|
||||
{
|
||||
DMSG(0, "NormSession::Open() rx_socket open error\n");
|
||||
Close();
|
||||
|
|
@ -1044,6 +1044,30 @@ void NormSession::DeleteTxObject(NormObject* obj)
|
|||
obj->Release();
|
||||
} // end NormSession::DeleteTxObject()
|
||||
|
||||
void NormSession::SetTxCacheBounds(NormObjectSize sizeMax,
|
||||
unsigned long countMin,
|
||||
unsigned long countMax)
|
||||
{
|
||||
tx_cache_size_max = sizeMax;
|
||||
tx_cache_count_min = (countMin < countMax) ? countMin : countMax;
|
||||
tx_cache_count_max = (countMax > countMin) ? countMax : countMin;
|
||||
// Now trim the tx_table as needed
|
||||
if (IsServer())
|
||||
{
|
||||
unsigned long count = tx_table.Count();
|
||||
while ((count >= tx_cache_count_min) &&
|
||||
((count >= tx_cache_count_max) ||
|
||||
(tx_table.GetSize() > tx_cache_size_max)))
|
||||
{
|
||||
// Remove oldest non-pending
|
||||
NormObject* oldest = tx_table.Find(tx_table.RangeLo());
|
||||
Notify(NormController::TX_OBJECT_PURGED, (NormServerNode*)NULL, oldest);
|
||||
DeleteTxObject(oldest);
|
||||
count = tx_table.Count();
|
||||
}
|
||||
}
|
||||
} // end NormSession::SetTxCacheBounds()
|
||||
|
||||
NormBlock* NormSession::ServerGetFreeBlock(NormObjectId objectId,
|
||||
NormBlockId blockId)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -136,7 +136,9 @@ class NormSession
|
|||
bool CongestionControl() {return cc_enable;}
|
||||
void SetCongestionControl(bool state) {cc_enable = state;}
|
||||
void SetTxRateBounds(double rateMin, double rateMax);
|
||||
|
||||
void SetTxCacheBounds(NormObjectSize sizeMax,
|
||||
unsigned long countMin,
|
||||
unsigned long countMax);
|
||||
void Notify(NormController::Event event,
|
||||
class NormServerNode* server,
|
||||
class NormObject* object)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#endif // UNIX
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
printf("normTest starting (sizeof(NormOffset) = %d)...\n", sizeof(NormOffset));
|
||||
printf("normTest starting (sizeof(NormSize) = %d)...\n", sizeof(NormSize));
|
||||
|
||||
NormInstanceHandle instance = NormCreateInstance();
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,6 @@
|
|||
|
||||
#ifndef _NORM_VERSION
|
||||
#define _NORM_VERSION
|
||||
#define VERSION "1.3b3"
|
||||
#define VERSION "1.3b4"
|
||||
#endif // _NORM_VERSION
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,12 @@
|
|||
|
||||
BUILD (Unix):
|
||||
|
||||
g++ -o normRecvFile normRecvFile.cpp -I../common/ -I../protolib/common \
|
||||
-DPROTO_DEBUG ../unix/libnorm.a ../protolib/unix/libProtokit.a -lpthread
|
||||
|
||||
g++ -o normFileSend normFileSend.cpp -D_FILE_OFFSET_BITS=64 -DPROTO_DEBUG \
|
||||
-I../common/ -I../protolib/common ../unix/libnorm.a \
|
||||
../protolib/unix/libProtokit.a -lpthread
|
||||
|
||||
(for MacOS/BSD, add "-lresolv")
|
||||
(for Solaris, add "-ldl -lnsl -lsocket -lresolv")
|
||||
(for Solaris, add "-lnsl -lsocket -lresolv")
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
|
|
@ -126,10 +127,11 @@ int main(int argc, char* argv[])
|
|||
// only calculate/post updates occasionally rather than for
|
||||
// each and every RX_OBJECT_UPDATE event)
|
||||
NormSize objectSize = NormObjectGetSize(theEvent.object);
|
||||
fprintf(stderr, "sizeof(NormSize) = %d\n", sizeof(NormSize));
|
||||
NormSize completed = objectSize - NormObjectGetBytesPending(theEvent.object);
|
||||
double percentComplete = 100.0 * ((double)completed/(double)objectSize);
|
||||
fprintf(stderr, "normFileRecv: completion status %lu/%lu (%3.0lf%%)\n",
|
||||
completed, objectSize, percentComplete);
|
||||
(unsigned long)completed, (unsigned long)objectSize, percentComplete);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,12 @@
|
|||
|
||||
BUILD (Unix):
|
||||
|
||||
g++ -o normFileSend normFileSend.cpp -I../common/ -I../protolib/common \
|
||||
../unix/libnorm.a ../protolib/unix/libProtokit.a -lpthread
|
||||
g++ -o normFileSend normFileSend.cpp -D_FILE_OFFSET_BITS=64 -I../common/ \
|
||||
-I../protolib/common ../unix/libnorm.a ../protolib/unix/libProtokit.a \
|
||||
-lpthread
|
||||
|
||||
(for MacOS/BSD, add "-lresolv")
|
||||
(for Solaris, add "-ldl -lnsl -lsocket -lresolv")
|
||||
(for Solaris, add "-lnsl -lsocket -lresolv")
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
|
|
@ -24,7 +25,7 @@
|
|||
|
||||
#include "normApi.h" // for NORM API
|
||||
|
||||
#include "protoDefs.h" // for ProtoSystemTime
|
||||
#include "protoDefs.h" // for ProtoSystemTime()
|
||||
#include "protoDebug.h" // for SetDebugLevel(), etc
|
||||
|
||||
#include <stdio.h> // for printf(), etc
|
||||
|
|
@ -70,7 +71,7 @@ int main(int argc, char* argv[])
|
|||
// (Need to include "protolib/common/protoDebug.h" for this
|
||||
//SetDebugLevel(2);
|
||||
// Uncomment to turn on debug NORM message tracing
|
||||
//NormSetMessageTrace(session, true);
|
||||
NormSetMessageTrace(session, true);
|
||||
// Uncomment to turn on some random packet loss
|
||||
// NormSetTxLoss(session, 10.0); // 10% packet loss
|
||||
struct timeval currentTime;
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ class UnixPostProcessor : public NormPostProcessor
|
|||
#endif // NETSCAPE_SUPPORT
|
||||
}; // end class UnixPostProcessor
|
||||
|
||||
|
||||
UnixPostProcessor::UnixPostProcessor()
|
||||
: process_id(0)
|
||||
#ifdef NETSCAPE_SUPPORT
|
||||
|
|
|
|||
BIN
win32/Norm.suo
BIN
win32/Norm.suo
Binary file not shown.
Loading…
Reference in New Issue