Network Developers Kit API 3.61.01.01

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
HTTP Server Service

The HTTP Server service provides a mechanism for serving HTTP content to remote HTTP client applications. More...

## Data Structures
struct | _ntparam_http
struct | _ci_service_http

## Macros
#define | HTTPPORT 80
#define | MAX_RESPONSE_SIZE 200
#define | http400(Sock) httpSendErrorResponse((Sock), HTTP_BAD_REQUEST)
#define | http404(Sock) httpSendErrorResponse((Sock), HTTP_NOT_FOUND)
#define | http405(Sock) httpSendErrorResponse((Sock), HTTP_NOT_ALLOWED)
#define | http501(Sock) httpSendErrorResponse((Sock), HTTP_NOT_IMPLEMENTED)

## Typedefs
typedef struct _ntparam_http | NTPARAM_HTTP
typedef struct _ci_service_http | CI_SERVICE_HTTP

## Enumerations
enum | HTTP_STATUS_CODE { HTTP_OK =200, HTTP_NO_CONTENT =204, HTTP_BAD_REQUEST =400, HTTP_AUTH_REQUIRED =401, HTTP_NOT_FOUND =404, HTTP_NOT_ALLOWED =405, HTTP_NOT_IMPLEMENTED =501, HTTP_STATUS_CODE_END }

## Functions
void * | httpOpen (NTARGS *pNTA, NTPARAM_HTTP *pNTP)
| Create an instance of the HTTP Server. More...
void | httpClose (void *hHTTP)
| Destroy an instance of the HTTP Server. More...
int | httpVersion (void)
void | httpSendClientStr (SOCKET Sock, char *Response)
void | httpSendStatusLine (SOCKET Sock, int StatusCode, char *ContentType)
void | httpSendFullResponse (SOCKET Sock, int StatusCode, char *RequestedFile)
void | httpSendEntityLength (SOCKET Sock, int32_t EntityLength)
void | httpSendErrorResponse (SOCKET Sock, int StatusCode)

## Variables
char * | CONTENT_TYPE_APPLET
char * | CONTENT_TYPE_AU
char * | CONTENT_TYPE_CSS
char * | CONTENT_TYPE_DOC
char * | CONTENT_TYPE_GIF
char * | CONTENT_TYPE_HTML
char * | CONTENT_TYPE_JPG
char * | CONTENT_TYPE_MPEG
char * | CONTENT_TYPE_PDF
char * | CONTENT_TYPE_WAV
char * | CONTENT_TYPE_ZIP
char * | CONTENT_TYPE
char * | CONTENT_LENGTH
char * | CRLF
char * | DEFAULT_NAME
char * | HTTP_VER
char * | SPACE
int(* | httpErrorResponseHook )(SOCKET Sock, int StatusCode)

## Detailed Description

The HTTP Server service provides a mechanism for serving HTTP content to remote HTTP client applications.

Deprecated:
  The HTTP Server support in the NDK is deprecated and will be removed in the near future. Users are highly recommended to migrate to the HTTPServer module provided by the Network Services (NS) Component.

## Macro Definition Documentation

## § HTTPPORT

#define HTTPPORT 80

## § MAX_RESPONSE_SIZE

#define MAX_RESPONSE_SIZE 200

## § http400

#define http400 | ( |  | Sock | ) | httpSendErrorResponse((Sock), HTTP_BAD_REQUEST)

## § http404

#define http404 | ( |  | Sock | ) | httpSendErrorResponse((Sock), HTTP_NOT_FOUND)

## § http405

#define http405 | ( |  | Sock | ) | httpSendErrorResponse((Sock), HTTP_NOT_ALLOWED)

## § http501

#define http501 | ( |  | Sock | ) | httpSendErrorResponse((Sock), HTTP_NOT_IMPLEMENTED)

## Typedef Documentation

## § NTPARAM_HTTP

typedef struct _ntparam_http NTPARAM_HTTP

## § CI_SERVICE_HTTP

typedef struct _ci_service_http CI_SERVICE_HTTP

Deprecated:
  The HTTP Server support in the NDK is deprecated and will be removed in the near future. Users are highly recommended to migrate to the HTTPServer module provided by the Network Services (NS) Component.

## Enumeration Type Documentation

## § HTTP_STATUS_CODE

enum HTTP_STATUS_CODE

Enumerator
HTTP_OK |
HTTP_NO_CONTENT |
HTTP_BAD_REQUEST |
HTTP_AUTH_REQUIRED |
HTTP_NOT_FOUND |
HTTP_NOT_ALLOWED |
HTTP_NOT_IMPLEMENTED |
HTTP_STATUS_CODE_END |

## Function Documentation

## § httpOpen()

void* httpOpen | ( | NTARGS * | pNTA,
|  | NTPARAM_HTTP * | pNTP
| ) |  |

Create an instance of the HTTP Server.

Deprecated:
  The HTTP Server support in the NDK is deprecated and will be removed in the near future. Users are highly recommended to migrate to the HTTPServer module provided by the Network Services (NS) Component.

Parameters

  [in] | pNTA | Pointer to common arg structure used for all services
  [in] | pNTP | Pointer to HTTP parameter structure

Remarks
  Starts the HTTP server process. This process will create a connection to the HTTP Port and listen. When a connection is made, another task will be created to service the request.

Returns
  Success: handle to new HTTP Server instance
  Failure: NULL

See also
  httpClose()

## § httpClose()

void httpClose | ( | void * | hHTTP | ) |

Destroy an instance of the HTTP Server.

Deprecated:
  The HTTP Server support in the NDK is deprecated and will be removed in the near future. Users are highly recommended to migrate to the HTTPServer module provided by the Network Services (NS) Component.

Parameters

  [in] | hHTTP | Handle to HTTP Server instance obtained from httpOpen()

Remarks
  Destroys the instance of the HTTP Server indicated by the supplied handle. Once called, the Server is shut down.

See also
  httpOpen()

## § httpVersion()

int httpVersion | ( | void |  | ) |

## § httpSendClientStr()

void httpSendClientStr | ( | SOCKET | Sock,
|  | char * | Response
| ) |  |

## § httpSendStatusLine()

void httpSendStatusLine | ( | SOCKET | Sock,
|  | int | StatusCode,
|  | char * | ContentType
| ) |  |

## § httpSendFullResponse()

void httpSendFullResponse | ( | SOCKET | Sock,
|  | int | StatusCode,
|  | char * | RequestedFile
| ) |  |

## § httpSendEntityLength()

void httpSendEntityLength | ( | SOCKET | Sock,
|  | int32_t | EntityLength
| ) |  |

## § httpSendErrorResponse()

void httpSendErrorResponse | ( | SOCKET | Sock,
|  | int | StatusCode
| ) |  |

## Variable Documentation

## § CONTENT_TYPE_APPLET

char* CONTENT_TYPE_APPLET

INTERNAL

## § CONTENT_TYPE_AU

char* CONTENT_TYPE_AU

## § CONTENT_TYPE_CSS

char* CONTENT_TYPE_CSS

## § CONTENT_TYPE_DOC

char* CONTENT_TYPE_DOC

## § CONTENT_TYPE_GIF

char* CONTENT_TYPE_GIF

## § CONTENT_TYPE_HTML

char* CONTENT_TYPE_HTML

## § CONTENT_TYPE_JPG

char* CONTENT_TYPE_JPG

## § CONTENT_TYPE_MPEG

char* CONTENT_TYPE_MPEG

## § CONTENT_TYPE_PDF

char* CONTENT_TYPE_PDF

## § CONTENT_TYPE_WAV

char* CONTENT_TYPE_WAV

## § CONTENT_TYPE_ZIP

char* CONTENT_TYPE_ZIP

## § CONTENT_TYPE

char* CONTENT_TYPE

## § CONTENT_LENGTH

char* CONTENT_LENGTH

## § CRLF

char* CRLF

## § DEFAULT_NAME

char* DEFAULT_NAME

## § HTTP_VER

char* HTTP_VER

## § SPACE

char* SPACE

## § httpErrorResponseHook

int(* httpErrorResponseHook) (SOCKET Sock, int StatusCode)

© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale