Lines Matching full:to

7 The uIP TCP/IP stack is intended to make it possible to communicate
10 their peers to have complex, full-size stacks, but can communicate
12 the order of a few kilobytes and RAM usage can be configured to be as
32 peer-to-peer networking over the Internet. For embedded systems, being
33 able to run native TCP/IP makes it possible to connect the system
34 directly to an intranet or even the global Internet. Embedded devices
36 being able to fully communicate with other hosts in the network.
39 resources both in terms of code size and memory usage to be useful in
42 impossible to fit the full TCP/IP stack into systems with a few tens
46 The uIP implementation is designed to have only the absolute minimal
54 assumption, it is possible to remove certain TCP/IP mechanisms that
56 essential, however, if the embedded device is to communicate with
58 peer-to-peer services and protocols. uIP is designed to be RFC
59 compliant in order to let the embedded devices to act as first-class
67 level protocols such as ARP which translates IP addresses to MAC
68 addresses, to application level protocols such as SMTP that is used to
70 protocols and upper layer protocols will be referred to as "the
72 or firmware and will be referred to as "the network device" that are
75 TCP provides a reliable byte stream to the upper layer protocols. It
85 packet will have to reassemble any fragmented IP packets before they
86 can be passed to higher layers.
95 that deal with the host to host communication and those that deal with
97 example of the first kind is "A TCP MUST be able to receive a TCP
99 MUST be a mechanism for reporting soft TCP error conditions to the
101 the first kind may not be able to communicate with other TCP/IP
102 implementations and may even lead to network failures. Violation of
104 within the system and will not affect host-to-host communication.
106 In uIP, all RFC requirements that affect host-to-host communication
107 are implemented. However, in order to reduce code size, we have
128 the network device driver should be called to send out these packets.
130 Periodic timeouts are used to drive TCP mechanisms that depend on
136 driver should called to send out the packets that may have been produced.
140 uIP requires a few functions to be implemented specifically for the
141 architecture on which uIP is intended to run. These functions should
164 implementation will have to do a number of 32-bit additions as part of
167 uIP leaves the 32-bit additions to be implemented by the architecture
180 TCP/IP stack to use, mechanisms used in traditional TCP/IP cannot be
187 packet buffer is large enough to contain one packet of maximum
192 next incoming packet, the application will either have to act
198 Ethernet controllers have on-chip buffers that are large enough to
201 bytes to a separate buffer during application processing. If the
212 buffer. To send the data, the application passes a pointer to the data
213 as well as the length of the data to the stack. The TCP/IP headers are
217 retransmissions. Instead, the application will have to reproduce the
222 to be run. The memory configuration determines both the amount of
223 traffic the system should be able to handle and the maximum amount of
227 simple Telnet server. It is possible to run the uIP implementation
246 uIP provides two APIs to programmers: protosockets, a BSD socket-like
258 invoked in response to certain events. An application running on top
260 response to certain events. uIP calls the application when data is
261 received, when data has been successfully delivered to the other end
263 has to be retransmitted. The application is also periodically polled
265 function; it is up to the application to deal with mapping different
266 network services to different ports and connections. Because the
267 application is able to act on incoming data and connection requests as
273 buffer the transmitted data in memory until the data is known to be
274 successfully delivered to the remote end of the connection. If the
275 data needs to be retransmitted, the stack takes care of the
277 the data has to be buffered in memory while waiting for an
278 acknowledgment even if the application might be able to quickly
279 regenerate the data if a retransmission has to be made.
281 In order to reduce memory usage, uIP utilizes the fact that the
282 application may be able to regenerate sent data and lets the
294 to note that even though the actual retransmission operation is
296 to know when the retransmission should be made. Thus the complexity of
304 test function that is used to distinguish between different
306 to either zero or non-zero. Note that certain events can happen in
313 set to point to the uip_conn structure for the connection that
316 used, e.g., to distinguish between different services, or to check to
318 to inspect the uip_conn->lport (the local TCP port number) to decide
320 application might decide to act as an HTTP server if the value of
321 uip_conn->lport is equal to 80 and act as a TELNET server if the value
327 the connection has sent new data. The uip_appdata pointer point to the
331 application will therefor have to either act directly on the incoming
338 application according to the available buffer space and the current
342 and the application may use the uip_mss() function to see how much
346 uip_send() function takes two arguments; a pointer to the data to be
349 (pointed to by the uip_appdata pointer) can be used for this purpose.
352 connection and it is not possible to call uip_send() more than once
374 retransmitting data. Also, it is important to note that even though
376 it is the responsibility of the stack to know when the retransmission
385 to be cleanly closed. In order to indicate a fatal error, the
386 application might want to abort the connection and does so by calling
395 There are two fatal errors that can happen to a connection, either
400 uip_timedout() to test for those error conditions.
406 uip_poll() to check if it is being polled by uIP.
408 The polling event has two purposes. The first is to let the
410 the application to close connections that have been idle for too
411 long. The other purpose is to let the application send new data that
413 uIP, and therefore the poll event is the only way to send data on an
424 The application can check the lport field in the uip_conn structure to
425 check to which port the new connection was connected.
432 which will open a TCP connection to the specified IP address and port
435 a pointer to the uip_conn structure for the new
439 The function uip_ipaddr() may be used to pack an IP address into the
440 two element 16-bit array used by uIP to represent IP addresses.
442 Two examples of usage are shown below. The first example shows how to
443 open a connection to TCP port 8080 of the remote end of the current
444 connection. If there are not enough TCP connection slots to allow a
445 new connection to be opened, the uip_connect() function returns NULL
456 The second example shows how to open a new connection to a specific IP
477 been established, the application replies to all data sent to it by
483 configuration variable UIP_APPCALL should be defined to be
498 The initialization function calls the uIP function uip_listen() to
501 to determine why it was called. If the application was called because
504 and has to be retransmitted, it also sends an "ok". Note that this
506 for an application to deal with all types of events such as
515 This application is similar to the first application in that it
516 listens to a port for incoming connections and responds to data sent
517 to it with a single "ok". The big difference is that this application
524 application must know what data to retransmit. If the "Welcome!"
538 When a remote host connects to the application, the application sends
539 the "Welcome!" message and sets it's state to WELCOME-SENT. When the
540 welcome message is acknowledged, the application moves to the
544 If the application is requested to retransmit the last message, it
605 If the system should run multiple applications, one technique to
606 differentiate between them is to use the TCP port number of either the
630 This example shows a simple application that connects to a host, sends
631 an HTTP request for a file and downloads it to a slow device such a
632 disk drive. This shows how to use the flow control functions of uIP.
663 When the connection has been established, an HTTP request is sent to
665 knows that if it needs to retransmit any data, it is that request that
666 should be retransmitted. It is therefore possible to combine these two
670 this data to the device by using the function device_enqueue(). It is
671 important to note that this example assumes that this function copies
678 uip_restart() is called. The application polling event is used to
685 to two ports and uses the port number to determine which file to
731 The application state consists of a pointer to the data that should be
732 sent and the size of the data that is left to send. When a remote host
733 connects to the application, the local port number is used to
734 determine which file to send. The first chunk of data is sent using
739 been acknowledged, new data can be sent. If there is no more data to
744 When writing larger programs using uIP it is useful to be able to
746 provides a structured design that has showed itself to be useful for
753 aborted(), and timedout(), and needs to be written specifically for
791 connection has been closed, the closed() function is called to the it
796 called and is supposed to do whatever needs to be done when the
799 out, the senddata() function is called to deal with the outgoing data.
803 waits for any data to arrive on the connection, and responds to the
804 data by sending out the message "Hello world!". To illustrate how to
869 pointer to a text message and the "textlen" length of the text
871 that the application is waiting for data to arrive from the network,
881 established, and in this case sets the "state" variable to be
882 "STATE_WAITING" and the "textlen" variable to be zero, indicating that
883 there is no message to be sent out.
888 switches to the "STATE_HELLO" state and registers a 6 byte long "Hello
894 first reduces the amount of data that is left to send, by subtracting
900 "STATE_HELLO" state, it switches state to "STATE_WORLD" and sets up a
901 7 byte "world!\n" message to be sent. If the application was in the
905 data that is to be sent. It is called by the event handler function
909 purpose of the senddata() function is to optionally format the data
910 that is to be sent, and to call the uip_send() function to actually
912 calls uip_send() with the appropriate arguments if data is to be sent,
916 It is important to note that the senddata() function never should
925 the layered approach is a good way to design protocols, it is not
926 always the best way to implement them. In uIP, the protocol
927 implementations are tightly coupled in order to save code space.
945 holds the packet to be reassembled. An incoming fragment is copied
946 into the right place in the buffer and a bit map is used to keep track
950 resulting IP packet is passed to the transport layer. If all fragments
955 packets to be reassembled, and therefore does not support simultaneous
957 uncommon, this ought to be a reasonable decision. Extending the
958 implementation to support multiple buffers would be straightforward,
963 IP has the ability to broadcast and multicast packets on the local
964 network. Such packets are addressed to special broadcast and multicast
968 RTP. TCP is a point-to-point protocol and does not use broadcast or
979 The ICMP implementation in uIP is very simple as itis restricted to
980 only implement ICMP echo messages. Replies to echo messages are
995 data that is to be delivered to the application, the application is
998 updated and the application is informed, allowing it to send out new
1003 TCP allows a connection to listen for incoming connection requests. In
1019 to be supported by a complex application layer. Instead, uIP allows
1020 only a single TCP segment per connection to be unacknowledged at any
1023 It is important to note that even though most TCP implementations use
1031 active connection in order to find a suitable value for the
1039 Jacobson's standard TCP RTT estimation function to calculate an
1040 estimate of the RTT. Karn's algorithm is used to ensure that
1061 to note that even though the actual retransmission operation is
1063 to know when the retransmission should be made. Thus the complexity of
1069 The purpose of TCP's flow control mechanisms is to allow communication
1077 bytes it is allowed to send by the receiving host. If the remote host
1085 are designed to be simple to implement and require only a few lines of
1094 TCP's urgent data mechanism provides an application-to-application
1095 notification mechanism, which can be used by an application to mark
1097 stream. It is up to the receiving application to interpret the meaning
1105 to increased complexity.
1114 the TCP/IP stack is run in the kernel, data has to be copied between
1116 context switch has to be performed once the data has been
1123 to have multiple protection domains and the power to run a
1124 multitasking operating system. Therefore there is no need to copy
1130 by the copying of packet data from the network device to host memory,
1133 updating a few counters and flags before handing the data over to the
1165 not very likely to have large amounts of data to send, the delayed