Difference between revisions of "UIP"
Jump to navigation
Jump to search
(Move MIB implementation to separate page) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 111: | Line 111: | ||
− | ===SNMP Agent | + | ===SNMP Agent=== |
*Simple Network Management Protocol (SNMP) is a standard protocol to access variables to remote device via the Internet. Reference in [http://en.wikipedia.org/wiki/Simple_Network_Management_Protocol wikipedia.org] | *Simple Network Management Protocol (SNMP) is a standard protocol to access variables to remote device via the Internet. Reference in [http://en.wikipedia.org/wiki/Simple_Network_Management_Protocol wikipedia.org] | ||
*It belongs to the Application Layer, as in HTTP. | *It belongs to the Application Layer, as in HTTP. | ||
Line 129: | Line 129: | ||
**Private variables may be constructed under the "enterprise" sub-tree. | **Private variables may be constructed under the "enterprise" sub-tree. | ||
**The OID for "enterprise" can be obtained from [http://www.iana.org/cgi-bin/enterprise.pl Internet Assigned Number Authority (IANA)]. | **The OID for "enterprise" can be obtained from [http://www.iana.org/cgi-bin/enterprise.pl Internet Assigned Number Authority (IANA)]. | ||
+ | **See [[SNMP MIB Implementation | here]] for method to generate MIB. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Reference== | ==Reference== |
Latest revision as of 18:23, 27 September 2010
This wiki describes how to use uIP (a Light-weight TCP/IP stack) for developing ethernet applications for 8/16-bit embedded system (see Ethernet_Module).
Introduction[edit]
- Developed by Adam Dunkels of the Networked Embedded Systems group at the Swedish Institute of Computer Science.
- uIP is under the BSD-style license
Bug List[edit]
- DHCP
- dhcp client fault from buffalo router
- occasionally cannot access webserver with dhcp
- DHCP
- dhcp client fault from main router
- occasionally cannot access webserver with dhcp
- possible cause: module tries to get IP configuration when switching on and off too frequently. This causes the router to enter into an unknown state. Even using the static mode with the same IP cannot get Internet access properly. When wait for some time and switch on the module again, the router may have been "reset", and the connection is ok again.
- SMTP
- some router cannot used SMTP module
- the router return its own IP as DNS resolver, and it does support only parsing direct IP function
- desktop applications (e.g. outlook, thunderbird, webmail) do not use DNS resolver (UDP application) to connect to the mail server, but use TCP/IP to do the job
To-Do List[edit]
- 32kB constant limitations
- see if webserver can be stored in flash in file system
- SNMP
- porting snmp to uip
- reference to lwip
- a API(or any method) to let other system to talk to our device OR by scpi, modbus
- https by SSL
- on chip SSL(more faster) OR software SSL(need to upgrade CPU power to process the calculation)
- reference - http://www.networkworld.com/news/tech/2002/0729tech.html
Porting[edit]
CVS Repository[edit]
Attribute | Value |
---|---|
Host | uip-stack.cvs.sourceforge.net |
Repository Path | /cvsroot/uip-stack |
Connection Type | pserver |
User | anonymous |
Patches[edit]
- Changes made to CVS Repository for porting to freertos_posix
- uip-patch-1.0-01.diff (minimal)
- uip.c
- Comment out all DEBUG_PRINTF(...) in lines 1, 323, 910, 1015, 1070, 1863, 1868, 1869
- uip.c
- uip-patch-1.0-02.diff (for pic30-elf-gcc compiler v3.01 or above)
- uip.h
- Change line 1070 to
# define HTONS(n) (u16_t)(((((u16_t) (n)) << 8)&0xff00) | ((((u16_t) (n)) >> 8)&0x00ff))
- Change line 1070 to
- psock.c
- Change line 188 to
s->sendptr = (u8_t*) buf; - Change lines 276, 303 to
buf_setup(&psock->buf, (u8_t*)(psock->bufptr), psock->bufsize); - Change line 334 to
buf_setup(&psock->buf, (u8_t*)buffer, buffersize);
- Change line 188 to
- uip.h
Implementation[edit]
- Include the following files to use the uIP stack
- timer.c
- uip.c
- uip_arp.c
- psock.c
- The following files have been created to port uIP 1.0 to dsPic33F development board using FreeRTOS
- clock-arch.c: return the os tick counts since the system is turned on.
- clock-arch.h: a constant specifying the number of os ticks in one second.
- uip-config.h: configuration for your application.
uIP Ethernet Application[edit]
- The following applications are modified from the demo applications in uIP.
DHCP Client[edit]
- Use project dhcpc_8bit
- Enable UDP in "uip-config.h"
#define UIP_CONF_UDP 1
- Make sure your uip buffer size is large enough (DHCP messages from some servers can be more than 500 bytes). In my setting, I use 1536 in "uip-config.h"
#define UIP_CONF_BUFFER_SIZE 1536
Web Server[edit]
- Use project webserver_8bit
add-on[edit]
- The Web Server included in uIP 1.0 has been designed to load/reload the entire page (either html/shtml files) in response to a HTTP GET command, e.g.
GET /index.html HTTP/1.1 GET /abc.shtml HTTP/1.1
- As a result, if the webpage is required to refresh the dynamic data periodically, the surfing experience will be degraded by the large transfer of datastream.
- In consideration of the above issue, a solution is proposed here, so that the webserver can handle this kind of cgi HTTP-request
GET /abc.shtml?val=500.0&button=Set HTTP/1.1
DNS Resolver[edit]
- Use project dns_resolv_8bit
- The uIP DNS resolver functions are used to lookup a hostname and map it to a numerical IP address. It maintains a list of resolved hostnames that can be queried with the resolv_lookup() function. New hostnames can be resolved using the resolv_query() function.
- When a hostname has been resolved (or found to be non-existant), the resolver code calls a callback function called resolv_found() that must be implemented by the module that uses the resolver.
- Router Setting
- Special attention should be paid to router setting, when the DNS Server address is acquired by DHCP.
- The DNS Resolver module assumes that the DNS server can support DNS TYPE of ANY, MX, CNAME and A. See http://www.networksorcery.com/enp/protocol/dns.htm for definitions of these options.
- In case the router itself does not support these options, the router should be set to deliver a DNS Server address which support these options.
SMTP Mail Client[edit]
- Use project smtpc_8bit
- The SMTP client searches the ip address of the mail server by a DNS call. It then logins to the server with the email account name and address using AUTH LOGIN. If login is successful, the mail is sent to the list of recipients.
SNMP Agent[edit]
- Simple Network Management Protocol (SNMP) is a standard protocol to access variables to remote device via the Internet. Reference in wikipedia.org
- It belongs to the Application Layer, as in HTTP.
- If a device is SNMP compatible, any SNMP compatible host system can monitor and control that device.
Components in a SNMP System[edit]
- Network Management Station (NMS)
- This is a client, initiating SNMP communication.
- This can be a PC with an NMS software (e.g. NINO), polling data from the SNMP agents periodically.
- SNMP Agents
- These are servers, responding to one or multiple NMS requests.
- Management Information Base (MIB)
- A special collection of variables managed by the SNMP agents.
- MIB has a tree-like structure.
- An Object Identifier (OID) is given for each node.
- Data are stored at the end-nodes.
- Private variables may be constructed under the "enterprise" sub-tree.
- The OID for "enterprise" can be obtained from Internet Assigned Number Authority (IANA).
- See here for method to generate MIB.
Reference[edit]
uIP[edit]
lwIP[edit]
HTML[edit]
- W3 Schools: Learning how to write HTML and JavaScript