* * $Log$ * *
Definiert in Datei utils.h.
gehe zum Quellcode dieser Datei
Datenstrukturen | |
struct | HTTP_SCHEME |
Funktionen | |
int | TcpHostConnect (TCPSOCKET *sock, CONST char *rhost, u_short port) |
Connect TCP host. | |
FILE * | TcpStreamAccept (TCPSOCKET *sock, u_short port, char *mode) |
int | TcpGetBuffer (TCPSOCKET *sock, char *buff, u_int size, u_int *status) |
Get a specified number of characters from TCP socket connection. | |
int | TcpGetLine (TCPSOCKET *sock, char *line, u_short size) |
Get line from TCP socket connection. | |
int | TcpGetTag (TCPSOCKET *sock, char *tag, int size) |
char * | LocateAttributeString (CONST char *tag, CONST char *name) |
int | TcpPutString (TCPSOCKET *sock, char *str) |
Send complete string via TCP. | |
int | TcpGetHeaderLines (TCPSOCKET *sock, char ***array) |
Get header line array from TCP socket connection. | |
void | TcpReleaseHeaderLines (char **array) |
Release previously allocated memory for the header lines. | |
HTTP_SCHEME * | HttpSchemeParse (CONST char *uri) |
void | HttpSchemeRelease (HTTP_SCHEME *schm) |
void | Led0 (int on) |
Switch LED0 on or off. |
int TcpHostConnect | ( | TCPSOCKET * | sock, | |
CONST char * | rhost, | |||
u_short | port | |||
) |
Connect TCP host.
Definiert in Zeile 68 der Datei utils.c.
Benutzt LOG_WARN, LogMsg(), proxy, HTTP_PROXY::proxy_host und HTTP_PROXY::proxy_port.
FILE* TcpStreamAccept | ( | TCPSOCKET * | sock, | |
u_short | port, | |||
char * | mode | |||
) |
int TcpGetBuffer | ( | TCPSOCKET * | sock, | |
char * | buff, | |||
u_int | size, | |||
u_int * | status | |||
) |
Get a specified number of characters from TCP socket connection.
The low level NutTcpReceive() routine may return less than the number of bytes specified. This routine makes sure, that the complete buffer is filled. However, an additional pointer to a status is passed to this routine. If the status changes, the routine will be aborted.
Any TCP receive timeout is ignored, but required in order to detect status changes.
sock | Socket descriptor. This pointer must have been retrieved by calling NutTcpCreateSocket(). In addition a connection must have been established by calling NutTcpConnect() or NutTcpAccept(). | |
buff | Pointer to the buffer. | |
size | Size of the buffer. | |
status | Pointer to a status. |
int TcpGetLine | ( | TCPSOCKET * | sock, | |
char * | line, | |||
u_short | size | |||
) |
Get line from TCP socket connection.
ASCII codes below 32 or above 127 are discarded.
sock | Socket descriptor. This pointer must have been retrieved by calling NutTcpCreateSocket(). In addition a connection must have been established by calling NutTcpConnect() or NutTcpAccept(). | |
line | Pointer to the buffer that receives the string. | |
size | Size of the buffer. If the received line doesn't fit, then remaining characters will be discarded. |
char* LocateAttributeString | ( | CONST char * | tag, | |
CONST char * | name | |||
) |
int TcpPutString | ( | TCPSOCKET * | sock, | |
char * | str | |||
) |
Send complete string via TCP.
The low level NutTcpSend() routine limits the number of bytes to the maximum segment size of the connection. This routine makes sure, that the complete string is transmitted.
sock | Socket descriptor. This pointer must have been retrieved by calling NutTcpCreateSocket(). In addition a connection must have been established by calling NutTcpConnect() or NutTcpAccept(). | |
str | Pointer to a buffer containing the string to send. |
int TcpGetHeaderLines | ( | TCPSOCKET * | sock, | |
char *** | array | |||
) |
Get header line array from TCP socket connection.
Receives lines from a TCP stream until the first empty line appears and stores all lines in an array of strings. The empty line is not stored, but the last pointer of the array is set to NULL.
The routine allocates the array and all string. The caller should use TcpReleaseHeaderLines() to release all allocated memory.
sock | Socket descriptor. This pointer must have been retrieved by calling NutTcpCreateSocket(). In addition a connection must have been established by calling NutTcpConnect() or NutTcpAccept(). | |
array | Pointer to a string array pointer, which receives the address of the newly allocated string array. If no non-empty lines were received or if an error occured, then the string array pointer will be set to NULL. |
Definiert in Zeile 338 der Datei utils.c.
Benutzt MAX_HEADERLINE_SIZE und TcpGetLine().
void TcpReleaseHeaderLines | ( | char ** | array | ) |
Release previously allocated memory for the header lines.
Should be called to release all memory allocated by TcpGetHeaderLines().
array | String array to be released. |
HTTP_SCHEME* HttpSchemeParse | ( | CONST char * | uri | ) |
Definiert in Zeile 453 der Datei utils.c.
Benutzt HttpSchemeRelease(), HTTP_SCHEME::schm_host, HTTP_SCHEME::schm_pass, HTTP_SCHEME::schm_path, HTTP_SCHEME::schm_port, HTTP_SCHEME::schm_portnum, HTTP_SCHEME::schm_uri, HTTP_SCHEME::schm_user und strdup().
void HttpSchemeRelease | ( | HTTP_SCHEME * | schm | ) |
void Led0 | ( | int | on | ) |