⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sntpslib.html

📁 Vxworks API操作系统和驱动程序设计API。压缩的HTML文件
💻 HTML
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/sntpsLib.html - generated by refgen from sntpsLib.c --> <title> sntpsLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference :  OS Libraries</i></a></p></blockquote><h1>sntpsLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sntpsLib</strong> - Simple Network Time Protocol (SNTP) server library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./sntpsLib.html#sntpsClockSet">sntpsClockSet</a>(&nbsp;)</b>  -  assign a routine to access the reference clock<br><b><a href="./sntpsLib.html#sntpsNsecToFraction">sntpsNsecToFraction</a>(&nbsp;)</b>  -  convert portions of a second to NTP format<br><b><a href="./sntpsLib.html#sntpsConfigSet">sntpsConfigSet</a>(&nbsp;)</b>  -  change SNTP server broadcast settings<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library implements the server side of the Simple Network Time Protocol(SNTP), a protocol that allows a system to maintain the accuracy of its internal clock based on time values reported by one or more remote sources. The library is included in the VxWorks image if <b>INCLUDE_SNTPS</b> is defined at the time the image is built.<p></blockquote><h4>USER INTERFACE</h4><blockquote><p>The routine <b>sntpsInit(&nbsp;)</b> is called automatically during system startup when the SNTP server library is included in the VxWorks image. Depending on the value of <b>SNTPS_MODE</b>, the server executes in either a passive or an active mode.  When <b>SNTPS_MODE</b> is set to <b>SNTP_PASSIVE</b> (0x2), the server waits forrequests from clients, and sends replies containing an NTP timestamp. Whenthe mode is set to <b>SNTP_ACTIVE</b> (0x1), the server transmits NTP timestampinformation at fixed intervals. <p>When executing in active mode, the SNTP server uses the <b>SNTPS_DSTADDR</b> and <b>SNTPS_INTERVAL</b> definitions to determine the target IP address and broadcastinterval.  By default, the server will transmit the timestamp information tothe local subnet broadcast address every 64 seconds.  These settings can bechanged with a call to the <b><a href="./sntpsLib.html#sntpsConfigSet">sntpsConfigSet</a>(&nbsp;)</b> routine.  The SNTP server operatingin active mode will still respond to client requests.<p>The <b>SNTP_PORT</b> definition in assigns the source and destination UDP port.  The default port setting is 123 as specified by the relevant RFC.  Finally, theSNTP server requires access to a reliable external time source.  The<b>SNTPS_TIME_HOOK</b> constant specifies the name of a routine with the followinginterface:<p><pre>    STATUS sntpsTimeHook (int request, void *pBuffer);</pre>This routine can be assigned directly by altering the value of <b>SNTPS_TIME_HOOK</b>or can be installed by a call to the <b><a href="./sntpsLib.html#sntpsClockSet">sntpsClockSet</a>(&nbsp;)</b> routine. The manual pagesfor <b><a href="./sntpsLib.html#sntpsClockSet">sntpsClockSet</a>(&nbsp;)</b> describe the parameters and required operation of thetimestamp retrieval routine.  Until this routine is specified, the SNTP serverwill not provide timestamp information.<p></blockquote><h4>VXWORKS AE PROTECTION DOMAINS</h4><blockquote><p>Under VxWorks AE, the SNPT server can run in the kernel protection domain only. The <b>SNTPS_TIME_HOOK</b> MUST, if used, must reference a function in the kernel protection domain.  This restriction does not apply under non-AE versions of VxWorks.  <p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>sntpsLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./sntpcLib.html#top">sntpcLib</a></b>, RFC 1769<hr><a name="sntpsClockSet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sntpsClockSet(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sntpsClockSet(&nbsp;)</strong> - assign a routine to access the reference clock</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS sntpsClockSet    (    FUNCPTR pClockHookRtn     /* new interface to reference clock */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine installs a hook routine that is called to access the reference clock used by the SNTP server. This hook routine must use the following interface:<pre>    STATUS sntpsClockHook (int request, void *pBuffer);</pre>The hook routine should copy one of three settings used by the server toconstruct outgoing NTP messages into <i>pBuffer</i> according to the value of the <i>request</i> parameter.  If the requested setting is available, the installed routine should return OK (or ERROR otherwise).<p>This routine calls the given hook routine with the <i>request</i> parameter set to <b>SNTPS_ID</b> to get the 32-bit reference identifier in the formatspecified in RFC 1769.  It also calls the hook routine with <i>request</i> set to <b>SNTPS_RESOLUTION</b> to retrieve a 32-bit value containing the clock resolution in nanoseconds.  That value will be used to determine the 8-bit signed integer indicating the clock precision (according to the format specified in RFC 1769).  Other library routines will set the <i>request</i> parameter to <b>SNTPS_TIME</b> to retrieve the current 64-bit NTP timestamp from <i>pBuffer</i> in host byte order.  The routine <b><a href="./sntpsLib.html#sntpsNsecToFraction">sntpsNsecToFraction</a>(&nbsp;)</b> will convert a value in nanoseconds to the format required for the NTP fractional part.<p></blockquote><h4>VXWORKS AE PROTECTION DOMAINS</h4><blockquote><p>Under VxWorks AE, you can call this function from within the kernel protection domain only.  In addition, all arguments to this function can  reference only that data which is valid in the kernel protection domain. This restriction does not apply under non-AE versions of VxWorks.  <p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR.<p></blockquote><h4>ERRNO</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./sntpsLib.html#top">sntpsLib</a></b><hr><a name="sntpsNsecToFraction"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sntpsNsecToFraction(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sntpsNsecToFraction(&nbsp;)</strong> - convert portions of a second to NTP format</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>ULONG sntpsNsecToFraction    (    ULONG nsecs               /* nanoseconds to convert to binary fraction */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine is provided for convenience in fulfilling an <b>SNTPS_TIME</b> requestto the clock hook.  It converts a value in nanoseconds to the fractional part of the NTP timestamp format.  The routine is not designed to convert non-normalized values greater than or equal to one second.  Although the NTP time format provides a precision of about 200 pico-seconds, rounding errors in the conversion process decrease the accuracy as the input value increases.In the worst case, only the 24 most significant bits are valid, which reducesthe precision to tenths of a micro-second.<p></blockquote><h4>RETURNS</h4><blockquote><p>Value for NTP fractional part in host-byte order.<p></blockquote><h4>ERRNO</h4><blockquote><p>N/A<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./sntpsLib.html#top">sntpsLib</a></b><hr><a name="sntpsConfigSet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>sntpsConfigSet(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>sntpsConfigSet(&nbsp;)</strong> - change SNTP server broadcast settings</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS sntpsConfigSet    (    int    setting,           /* configuration option to change */    void * pValue             /* new value for parameter */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine alters the configuration of the SNTP server when operatingin broadcast mode.  A <i>setting</i> value of <b>SNTPS_DELAY</b> interprets the contentsof <i>pValue</i> as the new 16-bit broadcast interval.  When <i>setting</i> equals<b>SNTPS_ADDRESS</b>, <i>pValue</i> should provide the string representation of anIP broadcast or multicast address (for example, "224.0.1.1").  Any changed settings will take effect after the current broadcast interval is completed and the corresponding NTP message is sent.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR.<p></blockquote><h4>ERRNO</h4><blockquote><p><p>&nbsp;<b>S_sntpsLib_INVALID_PARAMETER</b></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./sntpsLib.html#top">sntpsLib</a></b></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -