Nut/OS  4.10.3
API Reference
httpserv.c File Reference
#include <cfg/os.h>
#include <string.h>
#include <io.h>
#include <fcntl.h>
#include <time.h>
#include <dev/board.h>
#include <dev/urom.h>
#include <dev/nplmmc.h>
#include <dev/sbimmc.h>
#include <fs/phatfs.h>
#include <sys/version.h>
#include <sys/thread.h>
#include <sys/timer.h>
#include <sys/heap.h>
#include <sys/confnet.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <net/route.h>
#include <pro/httpd.h>
#include <pro/dhcp.h>
#include <pro/ssi.h>
#include <pro/asp.h>
#include <pro/discover.h>
#include <sys/osdebug.h>
#include <net/netdebug.h>
Include dependency graph for httpserv.c:

Go to the source code of this file.

Defines

#define MY_MAC   "\x00\x06\x98\x30\x00\x35"
#define MY_IPADDR   "192.168.192.35"
#define MY_IPMASK   "255.255.255.0"
#define MY_IPGATE   "192.168.192.1"
#define USE_DHCP
#define USE_DISCOVERY
#define MY_FSDEV   devUrom
#define HTTPD_SERVICE_STACK   ((2048 * NUT_THREAD_STACK_MULT) + NUT_THREAD_STACK_ADD)

Functions

int ShowForm (FILE *stream, REQUEST *req)
void Service (void *arg)
 HTTP service thread.
int main (void)
 Main application routine.

Define Documentation

#define MY_MAC   "\x00\x06\x98\x30\x00\x35"

Definition at line 51 of file httpserv.c.

Referenced by main().

#define MY_IPADDR   "192.168.192.35"

Definition at line 58 of file httpserv.c.

Referenced by main().

#define MY_IPMASK   "255.255.255.0"

Definition at line 65 of file httpserv.c.

Referenced by main().

#define MY_IPGATE   "192.168.192.1"

Definition at line 72 of file httpserv.c.

Referenced by main().

#define USE_DHCP

Definition at line 78 of file httpserv.c.

#define USE_DISCOVERY

Definition at line 80 of file httpserv.c.

#define MY_FSDEV   devUrom
Examples:
httpd/httpserv.c.

Definition at line 130 of file httpserv.c.

Referenced by main().

#define HTTPD_SERVICE_STACK   ((2048 * NUT_THREAD_STACK_MULT) + NUT_THREAD_STACK_ADD)
Examples:
httpd/httpserv.c, and httpd_upnp/httpserv.c.

Definition at line 179 of file httpserv.c.

Referenced by main().


Function Documentation

int ShowForm ( FILE stream,
REQUEST req 
)
Service ( void *  arg)

HTTP service thread.

The endless loop in this thread waits for a client connect, processes the HTTP request and disconnects. Nut/Net doesn't support a server backlog. If one client has established a connection, further connect attempts will be rejected. Typically browsers open more than one connection in order to load images concurrently. So we run this routine by several threads.

Examples:
httpd/httpserv.c, and httpd_upnp/httpserv.c.

Definition at line 587 of file httpserv.c.

References _fdopen(), fclose(), NutHeapAvailable, NutHttpProcessRequest(), NutSleep(), NutTcpAccept(), NutTcpCloseSocket(), NutTcpCreateSocket(), and printf.

Referenced by main().

Here is the call graph for this function: