Nut/OS  5.0.5
API Reference
streamio.h
Go to the documentation of this file.
00001 #ifndef _PRO_UHTTP_STREAMIO_H_
00002 #define _PRO_UHTTP_STREAMIO_H_
00003 
00004 /*
00005  * Copyright (C) 2012 by egnite GmbH
00006  *
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted provided that the following conditions
00011  * are met:
00012  *
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  * 3. Neither the name of the copyright holders nor the names of
00019  *    contributors may be used to endorse or promote products derived
00020  *    from this software without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00029  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00030  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00032  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00033  * SUCH DAMAGE.
00034  *
00035  * For additional information see http://www.ethernut.de/
00036  */
00037 
00038 /*
00039  * $Id$
00040  */
00041 
00042 #include <pro/uhttp/compiler.h>
00043 
00044 #if defined _WIN32
00045 #include <pro/uhttp/os/win/streamio.h>
00046 #elif defined __linux__
00047 #include <unistd.h>
00048 #else
00049 #include <pro/uhttp/os/nut/streamio.h>
00050 #endif
00051 
00057 
00058 /* \brief Platform dependent stream information structure type. */
00059 typedef struct _HTTP_STREAM HTTP_STREAM;
00060 
00061 /* \brief Client handler type. */
00062 typedef void (*HTTP_CLIENT_HANDLER) (HTTP_STREAM *);
00063 
00064 
00073 extern int StreamInit(void);
00074 
00088 extern int StreamClientAccept(HTTP_CLIENT_HANDLER handler, const char *params);
00089 
00107 extern int StreamReadUntilChars(HTTP_STREAM *sp, const char *delim, const char *ignore, char *buf, int siz);
00108 
00126 extern int StreamReadUntilString(HTTP_STREAM *sp, const char *delim, char *buf, int siz);
00127 
00141 extern int s_write(const void *buf, size_t size, size_t count, HTTP_STREAM *sp);
00142 
00153 extern int s_puts(const char *str, HTTP_STREAM *sp);
00154 
00162 extern int s_vputs(HTTP_STREAM *sp, ...);
00163 
00175 extern int s_printf(HTTP_STREAM *sp, const char *fmt, ...);
00176 
00190 extern int s_flush(HTTP_STREAM *sp);
00191 
00195 #define SITEM_REMOTE_ADDR  1
00196 
00197 #define SITEM_REMOTE_PORT  2
00198 
00199 #define SITEM_SERVER_ADDR  3
00200 
00201 #define SITEM_SERVER_NAME  4
00202 
00203 #define SITEM_SERVER_PORT  5
00204 
00206 extern const char *StreamInfo(HTTP_STREAM *hs, int item);
00207 
00209 #endif