KwikNet ®TCP/IP StackUSER'S GUIDEVersion 3First Printing: May 15, 1998Last Printing: September 15, 2005Manual Order Number: PN303-9Copyright © 19
viiiKADAKKwikNet User's GuideKwikNet TCP/IP Stack User's GuideTable of Contents (continued)Page4. KwikNet Low Level Services (continued) 13
86KADAKKwikNet System ConfigurationSLIP IP Address Definition (continued)Edit: IP AddressYou must select the Edit: IP Address radio button to define t
KwikNet System ConfigurationKADAK872.6 Adding a PPP Network InterfaceThe easiest way to add a PPP network interface to your system is to let KwikNet
88KADAKKwikNet System ConfigurationPPP Network Definition (continued)TagEach network must have a unique network tag. The tag is a string of 1 to 7 ch
KwikNet System ConfigurationKADAK89PPP Network Definition (continued)Modem ConnectionThe PPP network driver supports remote connections using the Kwik
90KADAKKwikNet System ConfigurationPPP Network Definition (continued)PPP OptionsClick on the PPP Options... button to open the PPP Options Dialog. Wi
KwikNet System ConfigurationKADAK91PPP Network Definition (continued)LCP Negotiation OptionsHeader CompressionCheck this box if the PPP network is per
92KADAKKwikNet System ConfigurationPPP Network Definition (continued)IPCP Negotiation OptionsIP CompressionCheck this box if the PPP network is permit
KwikNet System ConfigurationKADAK93PPP Options (continued)Local IP AddressThe IP address for each PPP network is usually edited in the network's
94KADAKKwikNet System ConfigurationPPP Serial Device Driver DefinitionYou must define the device driver attached to each prebuilt network which yourap
KwikNet System ConfigurationKADAK95PPP Serial Device Driver Definition (continued)TagEach device driver inherits the unique network tag assigned to th
KwikNet User's GuideKADAKixKwikNet TCP/IP Stack User's GuideTable of Contents (continued)Page7. KwikNet Virtual File System 2397.1 Introdu
96KADAKKwikNet System ConfigurationPPP IP Address DefinitionYou must provide a network IP address for each prebuilt network which your applicationsupp
KwikNet System ConfigurationKADAK97PPP IP Address Definition (continued)Edit: IP AddressYou must select the Edit: IP Address radio button to define th
98KADAKKwikNet System ConfigurationPPP IP Address Definition (continued)Default GatewayCheck this box if you want the IP address of the foreign host t
KwikNet System ConfigurationKADAK992.7 Modem OptionsIf a KwikNet network requires modem support, you must define the modem parameterswhich govern its
100KADAKKwikNet System ConfigurationModem Options (continued)Connection MethodFrom the pull down list, choose the method by which the modem connection
KwikNet System ConfigurationKADAK101Modem Options (continued)Initialization StringThe modem initialization string is sent to the modem before each dia
102KADAKKwikNet System ConfigurationThis page left blank intentionally.
KwikNet System ConstructionKADAK1033. KwikNet System Construction3.1 Building an ApplicationIf you are using KwikNet with AMX or have ported KwikNet
104KADAKKwikNet System Construction3.2 Making the KwikNet LibraryTo build the KwikNet Library, you will need a make utility capable of running your C
KwikNet System ConstructionKADAK105KwikNetConfigurationBuilderCompilerHeaderKNZZZCC.HTailoringFileKNZZZCC.INCOS InterfaceModuleKN_OSIF.CKN_OSIF.HOS In
xKADAKKwikNet User's GuideKwikNet TCP/IP Stack User's GuideAppendicesPageAppendix A. Reference Materials and Glossary A-1A.1 Reference M
106KADAKKwikNet System ConstructionKwikNet Directories and FilesThe make process depends upon the structure of the KwikNet installation directoryKNTnn
KwikNet System ConstructionKADAK107KwikNet Library Make FileThe KwikNet Configuration Builder is used to create and edit your Network ParameterFile, s
108KADAKKwikNet System ConstructionCreating the KwikNet LibraryThe KwikNet Library must be constructed from within directory MAKE in the KwikNetinsta
KwikNet System ConstructionKADAK1093.3 KwikNet Library Compilation OutputWhen you build the KwikNet Library as described in Chapter 3.2, the make uti
110KADAKKwikNet System Construction3.4 Compiling Application ModulesIn order to compile an application C source file, say MYFILE.C, which makes use o
KwikNet System ConstructionKADAK1113.5 Linking the ApplicationTo add KwikNet to your application, you must include the KwikNet Library moduleKNnnnIP.
112KADAKKwikNet System Construction3.6 Making the TCP/IP Sample ProgramThe KwikNet TCP/IP Stack includes a sample program, a working application that
KwikNet System ConstructionKADAK113TCP/IP Sample Program FilesTo build the KwikNet TCP/IP Sample Program using make file KNSAMPLE.MAK, each of thefoll
114KADAKKwikNet System ConstructionTCP/IP Sample Program Parameter FileThe Network Parameter File KNSAMLIB.UP describes the KwikNet options and featur
KwikNet System ConstructionKADAK115The TCP/IP Sample Program Make ProcessEach KwikNet sample program must be constructed from within the sample progr
KwikNet User's GuideKADAKxiKwikNet TCP/IP Stack User's GuideTable of FiguresPageFigure 1.2-1 KwikNet Application Block Diagram ...
116KADAKKwikNet System Construction3.7 Using KwikNet with AMX3.7.1 AMX System ConfigurationKwikNet includes its own interface to the underlying oper
KwikNet System ConstructionKADAK117AMX Interrupt StackYou may have to grow the size of your AMX Interrupt Stack, the stack used by allInterrupt Servic
118KADAKKwikNet System ConstructionKwikNet Restart and Exit ProceduresYou must include KwikNet Restart Procedure kn_osready first (or near first) in y
KwikNet System ConstructionKADAK1193.7.2 AMX Target ConfigurationEach KwikNet device driver for AMX includes an Interrupt Service Procedure consistin
120KADAKKwikNet System Construction3.7.3 Toolset ConsiderationsTailoring FilesThe KwikNet Library is constructed using your make utility, C compiler
KwikNet System ConstructionKADAK1213.7.4 AMX Application Construction SummaryConstruction of any KwikNet application for use with AMX will closely fo
122KADAKKwikNet System ConstructionThis page left blank intentionally.
KwikNet Low Level ServicesKADAK1234. KwikNet Low Level Services4.1 The UDP Programming InterfaceApplications which are memory constrained or have no
124KADAKKwikNet Low Level ServicesThe UDP ChannelKwikNet offers an alternate, low level UDP API which you enable by editing yourNetwork Parameter File
KwikNet Low Level ServicesKADAK125Receiving UDP DatagramsIf you expect to receive a UDP datagram from a foreign host, your open request mustprovide a
xiiKADAKKwikNet User's GuideThis page left blank intentionally.
126KADAKKwikNet Low Level ServicesProcessing Received UDP DatagramsYour UDP callback function executes in the context of the KwikNet Task. Your funct
KwikNet Low Level ServicesKADAK1274.2 DHCP, BOOTP and Auto IP4.2.1 DHCP and BOOTPKwikNet includes support for the Dynamic Host Configuration Protoco
128KADAKKwikNet Low Level ServicesDHCP and BOOTP OperationThe KwikNet DHCP Client automatically requests an IP address for a DHCP enabledEthernet net
KwikNet Low Level ServicesKADAK129DHCP TimeoutIf no response is received from any DHCP or BOOTP server within the timeout interval(initially four seco
130KADAKKwikNet Low Level Services4.2.2 Auto IP OperationThere is an optional KwikNet component which provides the Auto IP service which anEthernet n
KwikNet Low Level ServicesKADAK1314.3 The DNS ClientThe KwikNet DNS Client is an optional component providing support for the DomainName System (DNS
132KADAKKwikNet Low Level ServicesDNS QueriesThe DNS client will always start a new DNS name lookup by querying the primary DNSserver first. If no pr
KwikNet Low Level ServicesKADAK1334.4 ICMP ProtocolKwikNet includes support for the subset of Internet Control Message Protocol (ICMP)services it nee
134KADAKKwikNet Low Level ServicesThis page left blank intentionally.
KwikNet Low Level ServicesKADAK1354.5 KwikNet Network Interface ServicesIntroduction to Network InterfacesMost embedded systems include one or two ne
KwikNet OverviewKADAK11. KwikNet Overview1.1 IntroductionThe KwikNet® TCP/IP Stack is a compact, reliable, high performance TCP/IP stack, wellsuited
136KADAKKwikNet Low Level ServicesNetwork DescriptorWhen a network interface is added with a call to kn_ifadd(), KwikNet allocates anetwork descripto
KwikNet Low Level ServicesKADAK137Network Parameter StructureWhen a network interface is opened with a call to kn_ifopen(), KwikNet configures theinte
138KADAKKwikNet Low Level ServicesNetwork Parameter Structure (SLIP)struct knx_np_slip {struct in_addr xp_slip_ipaddr; /* Network IP address */struct
KwikNet Low Level ServicesKADAK139Network Parameter Structure (PPP)struct knx_np_ppp {struct in_addr xp_ppp_ipaddr; /* Network IP address */struct in_
140KADAKKwikNet Low Level ServicesNetwork AttributesEach network parameter structure includes a field which is used to specify the networkinterface at
KwikNet Low Level ServicesKADAK141Network StatesA network interface is always in one of three states. The interface is down when firstadded to the Kw
142KADAKKwikNet Low Level ServicesStarting and Stopping KwikNetMost applications start KwikNet with a call to kn_enter() and allow KwikNet to runforev
KwikNet Low Level ServicesKADAK1434.6 KwikNet Library ServicesThe KwikNet Library provides a set of network services from which the real-time systemd
144KADAKKwikNet Low Level ServicesThe following BSD-like services are also available in the KwikNet IP Library.gethostbyname Get the IP address of a h
KwikNet Low Level ServicesKADAK145KwikNet Procedure DescriptionsA description of all KwikNet low level service procedures is provided in this chapter.
2KADAKKwikNet OverviewInstallationKwikNet is delivered to you on a CD-ROM. During installation you will need yourKwikNet CD serial number and product
146KADAKKwikNet Low Level ServicesKwikNet Procedure Descriptions (continued)Used by n Task o ISP o Timer Procedure o Restart Procedure o Exit Procedur
KwikNet Low Level ServicesKADAK147hton– hton–ntoh– ntoh–Purpose Convert Between Host and Network Endian FormsUsed byn Task n ISP n Timer Procedure n R
148KADAKKwikNet Low Level Serviceskn_addserver kn_addserverPurpose Install (Add) a Server FunctionUsed byn Task o ISP o Timer Procedure o Restart Proc
KwikNet Low Level ServicesKADAK149kn_cksum kn_cksumPurpose Compute an IP ChecksumUsed byn Task o ISP o Timer Procedure o Restart Procedure o Exit Proc
150KADAKKwikNet Low Level Serviceskn_dprintf kn_dprintfPurpose Format and Log a Text MessageUsed byn Task o ISP o Timer Procedure n Restart Procedure
KwikNet Low Level ServicesKADAK151kn_enter kn_enterkn_exit kn_exitPurpose Launch or Terminate the KwikNet TCP/IP StackUsed by n Task o ISP o Timer Pro
152KADAKKwikNet Low Level Serviceskn_fmt kn_fmtPurpose Format a Text StringUsed byn Task o ISP o Timer Procedure n Restart Procedure n Exit ProcedureS
KwikNet Low Level ServicesKADAK153Formats ...continuedAllowable format specification strings must be of the form "...%-0##z?..."where:% = f
154KADAKKwikNet Low Level Serviceskn_godown kn_godownPurpose Initiate a Shutdown of the KwikNet TCP/IP StackUsed byn Task o ISP o Timer Procedure o Re
KwikNet Low Level ServicesKADAK155kn_ifadd kn_ifaddPurpose Add a Network InterfaceUsed byn Task o ISP o Timer Procedure o Restart Procedure o Exit Pro
KwikNet OverviewKADAK3ManualsThis KwikNet User's Guide describes how KwikNet is used with the standard distributionof Turbo Treck from Treck Inc.
156KADAKKwikNet Low Level Serviceskn_ifaddress kn_ifaddressPurpose Get the IP Address for a Network InterfaceUsed byn Task o ISP o Timer Procedure o R
KwikNet Low Level ServicesKADAK157kn_ifclose kn_ifclosePurpose Close a Network InterfaceUsed byn Task o ISP o Timer Procedure o Restart Procedure n Ex
158KADAKKwikNet Low Level Serviceskn_iffind kn_iffindPurpose Find a Network Interface with a Specific Network TagUsed byn Task o ISP o Timer Procedure
KwikNet Low Level ServicesKADAK159kn_ifinfo kn_ifinfoPurpose Fetch Information About a Network InterfaceUsed byn Task o ISP o Timer Procedure o Restar
160KADAKKwikNet Low Level Serviceskn_ifmodem kn_ifmodemPurpose Attach the Modem Driver to a Network InterfaceUsed byn Task o ISP o Timer Procedure o R
KwikNet Low Level ServicesKADAK161kn_ifnethook kn_ifnethookPurpose Register a Network Hook Function for a Network InterfaceUsed byn Task o ISP o Timer
162KADAKKwikNet Low Level Serviceskn_ifnext kn_ifnextPurpose Find the Next Available Network InterfaceUsed byn Task o ISP o Timer Procedure o Restart
KwikNet Low Level ServicesKADAK163kn_ifopen kn_ifopenPurpose Open a Network InterfaceUsed byn Task o ISP o Timer Procedure o Restart Procedure n Exit
164KADAKKwikNet Low Level Serviceskn_ifstate kn_ifstatePurpose Query the State of a Network InterfaceUsed byn Task o ISP o Timer Procedure o Restart P
KwikNet Low Level ServicesKADAK165kn_inet_addr kn_inet_addrPurpose Convert a Dotted Decimal IP Address to Numeric FormUsed byn Task o ISP o Timer Proc
4KADAKKwikNet OverviewThe KwikNet User's GuideChapter 1 provides an overview of the KwikNet TCP/IP Stack. The general operation ofKwikNet is des
166KADAKKwikNet Low Level Serviceskn_inet_ntoa kn_inet_ntoaPurpose Convert a Numeric IP Address to Dotted Decimal String FormUsed byn Task o ISP o Tim
KwikNet Low Level ServicesKADAK167kn_logbuffree kn_logbuffreePurpose Free a KwikNet Log BufferUsed byn Task o ISP o Timer Procedure o Restart Procedur
168KADAKKwikNet Low Level Serviceskn_netevent kn_neteventPurpose Notify Application of Significant Network Event (User Function)Used byn Task o ISP o
KwikNet Low Level ServicesKADAK169kn_netstats kn_netstatsPurpose Log KwikNet Network StatisticsUsed byn Task o ISP o Timer Procedure o Restart Procedu
170KADAKKwikNet Low Level Serviceskn_panic kn_panicPurpose Generate a KwikNet Fatal ErrorUsed byn Task o ISP o Timer Procedure o Restart Procedure n E
KwikNet Low Level ServicesKADAK171kn_state kn_statePurpose Sense the Operating State of the KwikNet TCP/IP StackUsed byn Task o ISP o Timer Procedure
172KADAKKwikNet Low Level Serviceskn_udpbind kn_udpbindPurpose Bind a Local IP Address and Port to a UDP ChannelUsed byn Task o ISP o Timer Procedure
KwikNet Low Level ServicesKADAK173kn_udpclose kn_udpclosePurpose Close a UDP ChannelUsed byn Task o ISP o Timer Procedure o Restart Procedure n Exit P
174KADAKKwikNet Low Level Serviceskn_udpfree kn_udpfreePurpose Free a Received UDP Message PacketUsed byn Task o ISP o Timer Procedure o Restart Proce
KwikNet Low Level ServicesKADAK175kn_udpopen kn_udpopenPurpose Open a UDP Channel to Send/Receive UDP Datagrams on a NetworkUsed byn Task o ISP o Time
KwikNet OverviewKADAK5The Treck TCP/IP User ManualThe Treck TCP/IP User Manual provides extensive documentation of the Turbo TreckTCP/IP Stack and the
176KADAKKwikNet Low Level ServicesDescription ...continuedUdprcv is the name of your application callback function which will becalled to process rece
KwikNet Low Level ServicesKADAK177...continuedExample #include "kn_lib.h"CJ_ID udptaskid; /* UDP Task id */volatile int udpresult; /* Result
178KADAKKwikNet Low Level Serviceskn_udpsend kn_udpsendPurpose Send a UDP Datagram on a NetworkUsed byn Task o ISP o Timer Procedure o Restart Procedu
KwikNet Low Level ServicesKADAK179kn_yield kn_yieldPurpose Yield to the KwikNet TaskUsed byn Task o ISP o Timer Procedure o Restart Procedure o Exit P
180KADAKKwikNet Low Level Servicesntoh– ntoh–hton– hton–Purpose Convert Between Network and Host Endian FormsUsed byn Task n ISP n Timer Procedure n R
KwikNet TCP/IP SocketsKADAK1815. KwikNet TCP/IP Sockets5.1 Introduction to KwikNet SocketsSockets is an application programming interface (API) whic
182KADAKKwikNet TCP/IP SocketsKwikNet Sockets APIThe KwikNet TCP sockets API is a subset of that available on UNIX systems. Examplesof networking cod
KwikNet TCP/IP SocketsKADAK183Non-Blocking SocketsWhen operations are performed using a socket, the caller requesting the action is usuallyforced to w
184KADAKKwikNet TCP/IP Sockets5.2 Socket TypesProcedure kn_socket() is used to create a socket. The KwikNet TCP/IP Stack onlysupports sockets for u
KwikNet TCP/IP SocketsKADAK185Functions kn_writev() and kn_readv() can also be used to send and receive data. Ifyou have provided a destination addre
6KADAKKwikNet OverviewKwikNet provides access to all of the network statistics maintained by the Turbo TreckTCP/IP Stack and it optional components.
186KADAKKwikNet TCP/IP SocketsUDP Sockets ExamplesThe following examples illustrate how a UDP socket can be used in a variety ofcircumstances for diff
KwikNet TCP/IP SocketsKADAK1875.3 Socket OptionsThe operation of sockets is controlled by socket level options. Options are alwayspresent at the soc
188KADAKKwikNet TCP/IP SocketsOption SO_BROADCAST requests permission to send broadcast datagrams on the socket.Option SO_OOBINLINE, used with protoco
KwikNet TCP/IP SocketsKADAK189Non-Standard Socket OptionsThe non-standard option SO_NONBLOCK can be used to set a socket into non-blockingmode so that
190KADAKKwikNet TCP/IP SocketsThis page left blank intentionally.
KwikNet TCP/IP SocketsKADAK1915.4 KwikNet Socket ServicesKwikNet Socket Service SummaryThe following list summarizes all of the KwikNet sockets proce
192KADAKKwikNet TCP/IP SocketsThis page left blank intentionally.
KwikNet TCP/IP SocketsKADAK193kn_accept kn_acceptPurpose Accept a Connection RequestUsed byn Task o ISP o Timer Procedure o Restart Procedure o Exit P
194KADAKKwikNet TCP/IP SocketsReturns ...continuedThe error indicator for socket s is set to define the reason for failure. Usekn_errno() to retrieve
KwikNet TCP/IP SocketsKADAK195kn_bind kn_bindPurpose Bind a Local Address to a SocketUsed byn Task o ISP o Timer Procedure o Restart Procedure o Exit
KwikNet OverviewKADAK71.2 General OperationThe KwikNet TCP/IP Stack and your application operate as illustrated in Figure 1.2-1. Ifyou are using Kwi
196KADAKKwikNet TCP/IP Socketskn_close kn_closePurpose Close a SocketUsed byn Task o ISP o Timer Procedure o Restart Procedure o Exit ProcedureSetup P
KwikNet TCP/IP SocketsKADAK197kn_connect kn_connectPurpose Connect a Socket to a Specific AddressUsed byn Task o ISP o Timer Procedure o Restart Proce
198KADAKKwikNet TCP/IP SocketsReturns ...continuedThe error indicator for socket s is set to define the reason for failure. Usekn_errno() to retrieve
KwikNet TCP/IP SocketsKADAK199kn_errno kn_errnoPurpose Get Error Code from Recent Socket OperationUsed byn Task o ISP o Timer Procedure o Restart Proc
200KADAKKwikNet TCP/IP Socketskn_getpeername kn_getpeernamePurpose Get the Address (Name) of the Remote End of a Connected SocketUsed byn Task o ISP o
KwikNet TCP/IP SocketsKADAK201kn_getsockname kn_getsocknamePurpose Get the Local Address (Name) of a SocketUsed byn Task o ISP o Timer Procedure o Res
202KADAKKwikNet TCP/IP Socketskn_getsockopt kn_getsockoptPurpose Get a Particular Socket OptionUsed byn Task o ISP o Timer Procedure o Restart Procedu
KwikNet TCP/IP SocketsKADAK203Description ...continuedOptionval is a pointer to storage for the option value. The size of eachoption is indicated in
204KADAKKwikNet TCP/IP Socketskn_listen kn_listenPurpose Request a Socket to Listen for Connection RequestsUsed byn Task o ISP o Timer Procedure o Res
KwikNet TCP/IP SocketsKADAK205kn_readv kn_readvPurpose Receive Scattered Data from a SocketUsed byn Task o ISP o Timer Procedure o Restart Procedure o
8KADAKKwikNet OverviewApplicationApplicationOS InterfaceKNSAMOS.CKNSAMOS.HKwikNetTCP/IPStackOS InterfaceModuleKN_OSIF.CKN_OSIF.HRT/OSRT/OSClock Driver
206KADAKKwikNet TCP/IP SocketsReturns ...continuedThe error indicator for socket s is set to define the reason for failure. Usekn_errno() to retrieve
KwikNet TCP/IP SocketsKADAK207kn_recv kn_recvPurpose Receive Data from a Connected SocketUsed byn Task o ISP o Timer Procedure o Restart Procedure o E
208KADAKKwikNet TCP/IP SocketsRestriction If there is no data available at the socket, the caller will be blocked waitingfor data to arrive unless the
KwikNet TCP/IP SocketsKADAK209kn_recvfrom kn_recvfromPurpose Receive Data from a SocketUsed byn Task o ISP o Timer Procedure o Restart Procedure o Exi
210KADAKKwikNet TCP/IP SocketsReturns If successful, the number of bytes of data stored at *buf is returned.If the socket is closed by the sender, the
KwikNet TCP/IP SocketsKADAK211kn_select kn_selectPurpose Select Sockets Ready for Receive or SendUsed byn Task o ISP o Timer Procedure o Restart Proce
212KADAKKwikNet TCP/IP SocketsDescription ...continuedTimeout is a pointer to a structure which defines the interval for which thecaller is prepared t
KwikNet TCP/IP SocketsKADAK213Returns If successful, this procedure returns the total number of ready socketsidentified in the descriptor sets. The v
214KADAKKwikNet TCP/IP Socketskn_send kn_sendPurpose Send Data to a Connected SocketUsed byn Task o ISP o Timer Procedure o Restart Procedure o Exit P
KwikNet TCP/IP SocketsKADAK215Restriction If none of the message data can be delivered to the socket, the caller willbe blocked unless the socket s is
KwikNet OverviewKADAK9KwikNet OperationThe KwikNet TCP/IP Stack can be used with either a multitasking RTOS or a singlethreaded operating system. Kw
216KADAKKwikNet TCP/IP Socketskn_sendto kn_sendtoPurpose Send Data to a SocketUsed byn Task o ISP o Timer Procedure o Restart Procedure o Exit Procedu
KwikNet TCP/IP SocketsKADAK217Returns If successful, the number of bytes of data sent from *buf is returned.On failure, the error status -1 is returne
218KADAKKwikNet TCP/IP Socketskn_setsockopt kn_setsockoptPurpose Set a Particular Socket OptionUsed byn Task o ISP o Timer Procedure o Restart Procedu
KwikNet TCP/IP SocketsKADAK219Description ...continuedOptionval is a pointer to the option value. The size of each option isindicated in the option l
220KADAKKwikNet TCP/IP Socketskn_shutdown kn_shutdownPurpose Shut down All or Part of a Full Duplex Socket ConnectionUsed byn Task o ISP o Timer Proce
KwikNet TCP/IP SocketsKADAK221kn_socket kn_socketPurpose Create a Socket (an Endpoint for Communication)Used byn Task o ISP o Timer Procedure o Restar
222KADAKKwikNet TCP/IP SocketsReturns If successful, a non-negative socket descriptor is returned.On failure, the error status -1 is returned.If a soc
KwikNet TCP/IP SocketsKADAK223kn_writev kn_writevPurpose Send Scattered Data to a SocketUsed byn Task o ISP o Timer Procedure o Restart Procedure o Ex
224KADAKKwikNet TCP/IP SocketsReturns ...continuedThe error indicator for socket s is set to define the reason for failure. Usekn_errno() to retrieve
KwikNet PPP OptionKADAK2256. KwikNet PPP Option6.1 Introduction to PPPThe Point-to-Point Protocol (PPP) is a network protocol used to control the de
10KADAKKwikNet OverviewMultitasking OperationIn a multitasking system which uses an RTOS, operation of the TCP/IP stack iscontrolled by a single task
226KADAKKwikNet PPP OptionBeyond the summary above, this manual makes no attempt to describe the Point-to-PointProtocol (PPP), what it is or how it op
KwikNet PPP OptionKADAK2276.2 KwikNet PPP ConfigurationYou can readily tailor the KwikNet stack to accommodate your PPP needs by using theKwikNet Con
228KADAKKwikNet PPP OptionPPP Network DefinitionYou must define each PPP network which your application must support. A separatedefinition is require
KwikNet PPP OptionKADAK229PPP OptionsFor each KwikNet network which supports PPP, you must define the PPP parameterswhich govern its use. These PPP o
230KADAKKwikNet PPP Option6.3 Using a PPP Network InterfaceThe PPP Client and ServerThe easiest way to add a PPP network interface to your KwikNet ap
KwikNet PPP OptionKADAK231Opening a PPP Network InterfaceThe KwikNet PPP network driver supervises the orderly opening of the PPP networkinterface.
232KADAKKwikNet PPP Option6.4 PPP Authentication ParametersIf any of your PPP networks require PAP, CHAP, MS-CHAP or EAP authentication, youmust prov
KwikNet PPP OptionKADAK233File KN_PPPAA.C provides the authentication parameters for one user on a single PPPnetwork interface. You must edit this mo
234KADAKKwikNet PPP Optionkn_ppp_admin kn_ppp_adminPurpose Provide PPP Authentication ServicesContextn KwikNet Task n Application TaskSetup Prototype
KwikNet PPP OptionKADAK235Description ...continuedInterpretation of parameters instr and outbuf for each value of opcodeis as follows.For operation co
KwikNet OverviewKADAK11Single Threaded OperationSingle threaded operation is only supported by KwikNet if you are using the KwikNetPorting Kit.In a si
236KADAKKwikNet PPP Option...continuedReturns For operations which return a pointer to an authentication parameter in thestorage at *outbuf, an intege
KwikNet PPP OptionKADAK2376.5 Adding PPP to Your ApplicationBefore you add the PPP protocol to your application, you must have a working KwikNet IPst
238KADAKKwikNet PPP OptionReconstructing Your KwikNet ApplicationIf you have not already done so, add your network serial device drivers to yourapplic
KwikNet Virtual File SystemKADAK2397. KwikNet Virtual File System7.1 IntroductionFor embedded systems which may not need a full-featured file system
240KADAKKwikNet Virtual File SystemVFS File NamesThe file name of a virtual file is a text string consisting of two parts, the volume base andthe file
KwikNet Virtual File SystemKADAK241VFS File OperationsThe Virtual File System provides a set of file access functions with names of the formkvf_xxxxx(
242KADAKKwikNet Virtual File SystemVFS File Access RightsUser access to files within the KwikNet Virtual File System is governed by the KwikNetAdminis
KwikNet Virtual File SystemKADAK2437.2 Virtual File System DefinitionEach KwikNet Virtual File System volume is defined by directives contained in a
244KADAKKwikNet Virtual File SystemA variation of the example from Figure 7.2-1 will illustrate how easy it is to reorganizefiles within a Virtual Fil
KwikNet Virtual File SystemKADAK245File CompressionThe VFS Generator can compress the files which make up your Virtual File System,thereby reducing th
12KADAKKwikNet OverviewYour App-Task can interact with KwikNet using the UDP or IP programming interface orthe TCP or UDP socket services.At times, Kw
246KADAKKwikNet Virtual File SystemVFS Definition File DirectivesEach directive in a VFS Definition File consists of a keyword of the form ...XXXXXX i
KwikNet Virtual File SystemKADAK247Source FilesThe files which are to be inserted into your Virtual File System are specified usingkeyword ...IN...IN
248KADAKKwikNet Virtual File SystemCompression ModeThe VFS Generator operates with file compression enabled or disabled. The currentcompression state
KwikNet Virtual File SystemKADAK249Tag String Case AdjustmentThe ...TAGCASE keyword is used to adjust the case of all compression strings definedusing
250KADAKKwikNet Virtual File SystemSector SizeVirtual files are stored in character arrays which, for lack of a better term, are calledsector arrays.
KwikNet Virtual File SystemKADAK2517.3 Using the VFS GeneratorThe KwikNet VFS Generator is a utility program which will create a Virtual File Systemf
252KADAKKwikNet Virtual File SystemVFS Template FileKN_VFG.CTVFS Definition FileYOUR_VFS.UVFVirtual File SystemGeneratorYOURVFS*.CVFSDataFile(s)VFS St
KwikNet Virtual File SystemKADAK253Running the VFS GeneratorThe KwikNet VFS Generator is a utility program which is provided ready for use on a PCor c
254KADAKKwikNet Virtual File System-p srcpath Srcpath is the full path defining the location of VFS source files whichare to be placed into the Virtua
KwikNet Virtual File SystemKADAK255-t template Template is the full path and file name of the KwikNet VFS Template File.The working directory is used
KwikNet OverviewKADAK131.3 KwikNet NomenclatureThe following nomenclature standards have been adopted throughout this manual.Numbers used in this man
256KADAKKwikNet Virtual File SystemCompiling the VFS Data FilesThe VFS Generator produces a set of one or more VFS Data Files which, collectively,form
KwikNet Virtual File SystemKADAK2577.4 Multiple VFS VolumesThe KwikNet Virtual File System usually consists of only one volume. However, theVirtual
258KADAKKwikNet Virtual File System7.5 VFS Service ProceduresThe following list summarizes KwikNet VFS service procedures which are accessible toyour
KwikNet Virtual File SystemKADAK259kvf_close kvf_closePurpose Close a Virtual FileUsed byn Task o ISP o Timer Procedure o Restart Procedure n Exit Pro
260KADAKKwikNet Virtual File Systemkvf_fsize kvf_fsizePurpose Fetch the Size of a Virtual FileUsed byn Task o ISP o Timer Procedure o Restart Procedur
KwikNet Virtual File SystemKADAK261kvf_isvfile kvf_isvfilePurpose Determine if a File is a Virtual FileUsed byn Task o ISP o Timer Procedure o Restart
262KADAKKwikNet Virtual File Systemkvf_open kvf_openPurpose Open a Virtual FileUsed byn Task o ISP o Timer Procedure o Restart Procedure n Exit Proced
KwikNet Virtual File SystemKADAK263kvf_read kvf_readPurpose Read from a Virtual FileUsed byn Task o ISP o Timer Procedure o Restart Procedure n Exit P
264KADAKKwikNet Virtual File Systemkvf_seek kvf_seekPurpose Seek Within a Virtual FileUsed byn Task o ISP o Timer Procedure o Restart Procedure n Exit
KwikNet Virtual File SystemKADAK265kvf_tell kvf_tellPurpose Determine the Current Position of the File Pointer in a Virtual FileUsed byn Task o ISP o
14KADAKKwikNet Overview1.4 Byte Ordering and EndiannessTo use a TCP/IP stack, you must adhere to the byte ordering rules defined by the TCP/IPprotoco
266KADAKKwikNet Virtual File Systemkvf_voladd kvf_voladdkvf_voldel kvf_voldelPurpose Add/Delete a Virtual File System VolumeUsed byn Task o ISP o Time
Reference Materials and GlossaryKADAKA - 1A. Reference Materials and GlossaryA.1 Reference MaterialsThe following reference books and documents are
A - 2KADAKReference Materials and GlossaryThis page left blank intentionally.
Reference Materials and GlossaryKADAKA - 3A.2 KwikNet GlossaryAPI An application programming interface defines the method bywhich a software program
A - 4KADAKReference Materials and GlossaryHandle An identifier assigned by AMX or KwikNet for use by yourapplication to reference a private AMX or Kwi
Reference Materials and GlossaryKADAKA - 5MAC Media Access Control: a general term used to define the methodby which access to a physical network is
A - 6KADAKReference Materials and GlossaryRAM Alterable memory used for data storage and stacks.Restart Procedure An AMX or application procedure exec
Reference Materials and GlossaryKADAKA - 7System Configuration ModuleA software module, produced by the AMX Configuration Builder,which defines the ch
A - 8KADAKReference Materials and GlossaryThis page left blank intentionally.
KwikNet Error CodesKADAKB - 1B. KwikNet Error CodesTCP/IP Socket Error CodesTCP/IP socket error codes are signed integers. An error code of -1 indic
KwikNet OverviewKADAK15Net Endian DataKwikNet provides a set of macros (or functions) which can be used by applications toconvert 2-byte (short) value
B - 2KADAKKwikNet Error CodesKwikNet Error CodesKwikNet error codes are signed integers. Codes less than zero are error codes. Codesgreater than zer
KwikNet Error CodesKADAKB - 3KwikNet Error Codes (continued)Mnemonic Value Value Meaning(dec) (hex)TFTP errorsKN_ERTFD -260 0xFEFC Invalid TFTP descri
B - 4KADAKKwikNet Error CodesKwikNet Error Codes (continued)Mnemonic Value Value Meaning(dec) (hex)SMTP errorsKN_ERSMND -280 0xFEE8 Invalid SMTP descr
KwikNet Error CodesKADAKB - 5KwikNet Fatal Error CodesMnemonic Value Value Meaning(dec) (hex)KN_FERNOTASK 100 0x0064 Cannot find KwikNet TaskKN_FERNOT
B - 6KADAKKwikNet Error CodesThis page left blank intentionally.
KwikNet Universal File System InterfaceKADAKC - 1C. KwikNet File System InterfaceC.1 IntroductionThe KwikNet TCP/IP Stack does not require a file s
C - 2KADAKKwikNet Universal File System InterfaceC.1.2 KwikNet Universal File SystemKwikNet provides an alternate interface to the file services prov
KwikNet Universal File System InterfaceKADAKC - 3C.2 KwikNet File System ParametersThe KwikNet Universal File System (UFS) interface and the Treck Fi
C - 4KADAKKwikNet Universal File System InterfaceFile System Parameters (continued)Attached File SystemIf you are using a KwikNet option such as FTP o
KwikNet Universal File System InterfaceKADAKC - 5File System Parameters (continued)Maximum Path and File Name LengthsSpecify the maximum number of cha
KwikNet User's GuideKADAKiTECHNICAL SUPPORTKADAK Products Ltd. is committed to technical support for its software products. Ourprograms are desi
16KADAKKwikNet Overview1.5 Memory Allocation RequirementsKwikNet must be able to dynamically allocate and free blocks of memory of varying sizes.Kwik
C - 6KADAKKwikNet Universal File System InterfaceC.3 Using the AMX/FS File SystemThe KwikNet Universal File System (UFS) interface supports the AMX/F
KwikNet Universal File System InterfaceKADAKC - 7AMX System StartupSpecial care must be taken when launching an AMX system which includes both KwikNet
C - 8KADAKKwikNet Universal File System InterfaceC.4 Using the MS-DOS File SystemWhen used with AMX 86, the KwikNet Universal File System (UFS) inter
KwikNet Universal File System InterfaceKADAKC - 9C.5 Using a Custom File SystemThe KwikNet Universal File System (UFS) interface can be adapted to su
C - 10KADAKKwikNet Universal File System InterfaceThis page left blank intentionally.
KwikNet Administration InterfaceKADAKD - 1D. KwikNet Administration InterfaceD.1 IntroductionMany network protocols, such as FTP, were originally de
D - 2KADAKKwikNet Administration InterfaceUser Access RightsUser access rights are formed from the logical OR of the following bit masks which aredefi
KwikNet Administration InterfaceKADAKD - 3D.2 KwikNet Administration ParametersThe KwikNet administration interface forms part of the KwikNet Librar
D - 4KADAKKwikNet Administration InterfaceAdministration Parameters (continued)Maximum User Name and Password LengthsSpecify the maximum number of cha
KwikNet Sample Program ArchitectureKADAKE - 1E. KwikNet Sample Program ArchitectureThe manner in which the KwikNet TCP/IP Sample Program starts and o
KwikNet OverviewKADAK17OS Memory ManagementThe third memory allocation strategy is to use the memory allocation services providedby the operating syst
E - 2KADAKKwikNet Sample Program ArchitectureKNSAMOS.CApplication OS Interfacemain() Sample program main entry pointsam_osshutdown() OS shutdown on ex
KwikNet Sample Program ArchitectureKADAKE - 3KwikNet Sample Program Operation with AMXWhen KwikNet is used with AMX, the KwikNet sample programs opera
E - 4KADAKKwikNet Sample Program ArchitectureThe sample program begins operation at task level once AMX completes its startupprocessing. The client
KwikNet Sample Program ArchitectureKADAKE - 5KwikNet Porting Kit Sample Program - Multitasking OperationWhen the KwikNet Porting Kit is used with a mu
E - 6KADAKKwikNet Sample Program ArchitectureThe sample program begins operation at task level once the high priority startup taskterminates. The cli
KwikNet Sample Program ArchitectureKADAKE - 7KwikNet Porting Kit Sample Program - Single Threaded OperationWhen the KwikNet Porting Kit is used with a
E - 8KADAKKwikNet Sample Program ArchitectureThis page left blank intentionally.
18KADAKKwikNet OverviewMemory Allocation ProtectionWhen operating in a multitasking environment, the memory allocation services must bethread-safe. I
KwikNet OverviewKADAK191.6 KwikNet Data Logging ServiceLike most TCP/IP stacks, KwikNet can generate a variety of messages to assist you in youruse o
20KADAKKwikNet OverviewMessage Print AttributesThe parameter defining the message print attributes includes three fields of interest to theuser: sever
KwikNet OverviewKADAK21KwikNet Data Log FunctionWhen message logging is enabled, the KwikNet message generation procedurekn_dprintf() calls the data l
22KADAKKwikNet Overview1.7 KwikNet Message Recording ServiceRecognizing that embedded systems may not be able to display or print messages,KADAK prov
KwikNet OverviewKADAK231.8 KwikNet Console DriverThe KwikNet sample programs provide support for a simple, interactive console device.The console dri
24KADAKKwikNet OverviewSerial I/O Terminal as the Console DeviceThe KwikNet sample program includes a UART serial I/O driver which can be used withthe
KwikNet OverviewKADAK251.9 Debugging AidsKwikNet includes a number of debug features which, if used effectively, can help you testyour networking app
iiKADAKKwikNet User's GuideCopyright © 1997-2005 by KADAK Products Ltd.All rights reserved.No part of this publication may be reproduced, transmi
26KADAKKwikNet OverviewBreakpoint TrapsKwikNet can generate a debug trap when it encounters an error condition which isgenerally not expected in the n
KwikNet OverviewKADAK27Debug MaskKwikNet maintains a public debug control variable, an unsigned integer namedkn_dbgflags. The bits in this variable a
28KADAKKwikNet Overview1.10 KwikNet TCP/IP Sample Program - A TutorialA TCP/IP Sample Program is provided with KwikNet to illustrate the use of the T
KwikNet OverviewKADAK29StartupThe manner in which the KwikNet TCP/IP Sample Program starts and operates iscompletely dependent upon the underlying ope
30KADAKKwikNet OverviewClient - Server Using TCP SocketsThis example illustrates the use of KwikNet's TCP/IP socket interface to establish aconne
KwikNet OverviewKADAK31The client calls kn_socket() to create a streaming socket. It then calls kn_bind() tobind itself to the socket, allowing KwikN
32KADAKKwikNet OverviewClient - Server Using UDP SocketsThis example illustrates the use of KwikNet's UDP socket interface to deliver UDPdatagram
KwikNet OverviewKADAK33The client then uses procedure kn_select() to wait until some data from the server isavailable for reading. The sample illustr
34KADAKKwikNet OverviewRunning the TCP/IP Sample ProgramThe KwikNet TCP/IP Sample Program load module is built just like any other KwikNetapplication
KwikNet System ConfigurationKADAK352. KwikNet System Configuration2.1 IntroductionCreating an application which uses the KwikNet TCP/IP Stack is a t
KwikNet User's GuideKADAKiiiCopyright NoticeSome components of the KwikNet TCP/IP Stack have been derivedfrom the University of California's
36KADAKKwikNet System ConfigurationTemplate FilesKwikNet Library MakeKNnnnLIB.MTKwikNet Library HeaderKNnnnLIB.HTNetwork Parameter FileNETCFG.UPConfig
KwikNet System ConfigurationKADAK372.2 KwikNet Configuration BuilderThe KwikNet Configuration Builder is a software generation tool which can be used
38KADAKKwikNet System ConfigurationScreen LayoutFigure 2.2-1 illustrates the Configuration Manager's screen layout. The title bar identifiesthe
KwikNet System ConfigurationKADAK39At the bottom of the screen is the status bar. As you select menu items, a briefdescription of their purpose is di
40KADAKKwikNet System ConfigurationField EditingWhen editing a parameter file, a collection of tabbed property sheets is displayed in thecentral regio
KwikNet System ConfigurationKADAK41Add, Edit and Delete KwikNet ObjectsSeparate property pages are provided to allow your definition of one or more Kw
42KADAKKwikNet System ConfigurationThis page left blank intentionally.
KwikNet System ConfigurationKADAK432.3 KwikNet Library ConfigurationThe KwikNet Library tabbed property sheet is displayed in the central region of t
44KADAKKwikNet System ConfigurationTarget ParametersThe KwikNet Library must be tailored to operate on a particular target processor. TheseKwikNet pa
KwikNet System ConfigurationKADAK45Target Parameters (continued)Data Alignment BoundaryFrom the pull down list, choose the target processor's nat
ivKADAKKwikNet User's GuideThis page left blank intentionally.
46KADAKKwikNet System ConfigurationOS ParametersThe KwikNet Library must be tailored to operate with a particular operating system.These KwikNet par
KwikNet System ConfigurationKADAK47OS Parameters (continued)Memory AllocationKwikNet must be able to dynamically allocate and free blocks of memory of
48KADAKKwikNet System ConfigurationOS Parameters (continued)Source and Size of Memory Region (Heap)If you use the KwikNet simple heap or operating sys
KwikNet System ConfigurationKADAK49OS Parameters (continued)Recycle Without Freeing MemoryKwikNet can recycle memory which it has allocated instead of
50KADAKKwikNet System ConfigurationGeneral Stack ParametersA number of general network parameters which apply to the complete KwikNet TCP/IPstack are
KwikNet System ConfigurationKADAK51General Stack Parameters (continued)Multiple NetworksLeave this box unchecked if you have only one network interfac
52KADAKKwikNet System ConfigurationGeneral Stack Parameters (continued)KwikNet OptimizationThe KwikNet Library can be optimized for speed or size. In
KwikNet System ConfigurationKADAK53IPv4 Stack ParametersThe KwikNet IPv4 Stack parameters are edited using the IPv4 property page. The layout ofthe w
54KADAKKwikNet System ConfigurationIPv4 Stack Parameters (continued)IP FragmentationIf you wish KwikNet to be able to split IP datagrams for transmiss
KwikNet System ConfigurationKADAK55IPv4 Stack Parameters (continued)UDP Channel SupportKwikNet offers a simplified UDP service for those not familiar
KwikNet User's GuideKADAKvKwikNet TCP/IP Stack User's GuideTable of ContentsPage1. KwikNet Overview 11.1 Introduction...
56KADAKKwikNet System ConfigurationTCP Stack ParametersThe KwikNet TCP Stack parameters and socket interface options are edited using the TCPproperty
KwikNet System ConfigurationKADAK57TCP Stack Parameters (continued)RFC2018: Selective AcknowledgementsThis box is normally checked so that KwikNet wil
58KADAKKwikNet System ConfigurationTCP Stack Parameters (continued)Maximum Number of SocketsEnter the maximum number of sockets which your application
KwikNet System ConfigurationKADAK59Ethernet ParametersKwikNet includes an Ethernet network driver which can support multiple Ethernetnetworks. From t
60KADAKKwikNet System ConfigurationEthernet Parameters (continued)Ethernet-II FramingCheck this box if you have one or more network interfaces that on
KwikNet System ConfigurationKADAK61Ethernet Parameters (continued)Transmit Packet Queue LimitThe KwikNet Ethernet Network Driver queues packets for tr
62KADAKKwikNet System ConfigurationPoint-to-Point (PPP) / SLIP / Modem ParametersKwikNet has an optional Point-to-Point (PPP) network driver which is
KwikNet System ConfigurationKADAK63PPP / SLIP / Modem Parameters (continued)Support PPPIf you have one or more PPP networks with serial UART device dr
64KADAKKwikNet System ConfigurationPPP / SLIP / Modem Parameters (continued)Include Modem SupportKwikNet includes a modem driver for use with any SLIP
KwikNet System ConfigurationKADAK65DNS Client ParametersKwikNet includes an optional DNS Client for accessing Domain Name System services oninterconne
viKADAKKwikNet User's GuideKwikNet TCP/IP Stack User's GuideTable of Contents (continued)Page2. KwikNet System Configuration 352.1 Introdu
66KADAKKwikNet System ConfigurationDNS Client Parameters (continued)Include DNS ClientIf your application needs access to Domain Name System services
KwikNet System ConfigurationKADAK67Optional ComponentsKwikNet includes a variety of client and server options, many of which are selected usingthe Opt
68KADAKKwikNet System ConfigurationOptional Components (continued)FTP ClientCheck this box if your application will include an FTP client which connec
KwikNet System ConfigurationKADAK69Debug and Logging ParametersKwikNet includes a number of debugging and data logging options. These options areenab
70KADAKKwikNet System ConfigurationDebug and Logging Parameters (continued)Informational MessagesCheck this box to enable informational messages to be
KwikNet System ConfigurationKADAK71Debug and Logging Parameters (continued)Enable Message LoggingCheck this box if you wish to provide a logging funct
72KADAKKwikNet System ConfigurationThis page left blank intentionally.
KwikNet System ConfigurationKADAK732.4 Adding an Ethernet Network InterfaceThe easiest way to add an Ethernet network interface to your system is to
74KADAKKwikNet System ConfigurationEthernet Network Definition (continued)TagEach network must have a unique network tag. The tag is a string of 1 to
KwikNet System ConfigurationKADAK75Ethernet Device Driver DefinitionYou must define the device driver attached to each prebuilt network which yourappl
KwikNet User's GuideKADAKviiKwikNet TCP/IP Stack User's GuideTable of Contents (continued)Page3. KwikNet System Construction (continued) 11
76KADAKKwikNet System ConfigurationEthernet Device Driver Definition (continued)TagEach device driver inherits the unique network tag assigned to the
KwikNet System ConfigurationKADAK77Ethernet IP Address DefinitionYou must provide a network IP address for each prebuilt network which your applicatio
78KADAKKwikNet System ConfigurationEthernet IP Address Definition (continued)IP VersionSelect the combination of IPv4 and IPv6 protocols that this net
KwikNet System ConfigurationKADAK79Ethernet IP Address Definition (continued)Runtime ConfigurationThis parameter is used to select one of the several
80KADAKKwikNet System ConfigurationThis page left blank intentionally.
KwikNet System ConfigurationKADAK812.5 Adding a SLIP Network InterfaceThe easiest way to add a SLIP network interface to your system is to let KwikNe
82KADAKKwikNet System ConfigurationSLIP Network Definition (continued)TagEach network must have a unique network tag. The tag is a string of 1 to 7 c
KwikNet System ConfigurationKADAK83SLIP Serial Device Driver DefinitionYou must define the device driver attached to each prebuilt network which youra
84KADAKKwikNet System ConfigurationSLIP Serial Device Driver Definition (continued)TagEach device driver inherits the unique network tag assigned to t
KwikNet System ConfigurationKADAK85SLIP IP Address DefinitionYou must provide a network IP address for each prebuilt network which your applicationsup
Comments to this Manuals