Example program with HTTPServer and sensor data streaming over TCPSockets, using Donatien Garnier's Net APIs and services code on top of LWIP. Files StreamServer.h and .cpp encapsulate streaming over TCPSockets. Broadcast is done by sendToAll(), and all incoming data is echoed back to the client. Echo code can be replaced with some remote control of the streaming interface. See main() that shows how to periodically send some data to all subscribed clients. To subscribe, a client should open a socket at <mbed_ip> port 123. I used few lines in TCL code to set up a quick sink for the data. HTTP files are served on port 80 concurrently to the streaming.

Dependencies:   mbed

Committer:
iva2k
Date:
Sat Jun 12 06:01:50 2010 +0000
Revision:
0:e614f7875b60

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
iva2k 0:e614f7875b60 1 /*****************************************************************************
iva2k 0:e614f7875b60 2 * auth.h - PPP Authentication and phase control header file.
iva2k 0:e614f7875b60 3 *
iva2k 0:e614f7875b60 4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
iva2k 0:e614f7875b60 5 * portions Copyright (c) 1998 Global Election Systems Inc.
iva2k 0:e614f7875b60 6 *
iva2k 0:e614f7875b60 7 * The authors hereby grant permission to use, copy, modify, distribute,
iva2k 0:e614f7875b60 8 * and license this software and its documentation for any purpose, provided
iva2k 0:e614f7875b60 9 * that existing copyright notices are retained in all copies and that this
iva2k 0:e614f7875b60 10 * notice and the following disclaimer are included verbatim in any
iva2k 0:e614f7875b60 11 * distributions. No written agreement, license, or royalty fee is required
iva2k 0:e614f7875b60 12 * for any of the authorized uses.
iva2k 0:e614f7875b60 13 *
iva2k 0:e614f7875b60 14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
iva2k 0:e614f7875b60 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
iva2k 0:e614f7875b60 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
iva2k 0:e614f7875b60 17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
iva2k 0:e614f7875b60 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
iva2k 0:e614f7875b60 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
iva2k 0:e614f7875b60 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
iva2k 0:e614f7875b60 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
iva2k 0:e614f7875b60 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
iva2k 0:e614f7875b60 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
iva2k 0:e614f7875b60 24 *
iva2k 0:e614f7875b60 25 ******************************************************************************
iva2k 0:e614f7875b60 26 * REVISION HISTORY
iva2k 0:e614f7875b60 27 *
iva2k 0:e614f7875b60 28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
iva2k 0:e614f7875b60 29 * Ported to lwIP.
iva2k 0:e614f7875b60 30 * 97-12-04 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
iva2k 0:e614f7875b60 31 * Original derived from BSD pppd.h.
iva2k 0:e614f7875b60 32 *****************************************************************************/
iva2k 0:e614f7875b60 33 /*
iva2k 0:e614f7875b60 34 * pppd.h - PPP daemon global declarations.
iva2k 0:e614f7875b60 35 *
iva2k 0:e614f7875b60 36 * Copyright (c) 1989 Carnegie Mellon University.
iva2k 0:e614f7875b60 37 * All rights reserved.
iva2k 0:e614f7875b60 38 *
iva2k 0:e614f7875b60 39 * Redistribution and use in source and binary forms are permitted
iva2k 0:e614f7875b60 40 * provided that the above copyright notice and this paragraph are
iva2k 0:e614f7875b60 41 * duplicated in all such forms and that any documentation,
iva2k 0:e614f7875b60 42 * advertising materials, and other materials related to such
iva2k 0:e614f7875b60 43 * distribution and use acknowledge that the software was developed
iva2k 0:e614f7875b60 44 * by Carnegie Mellon University. The name of the
iva2k 0:e614f7875b60 45 * University may not be used to endorse or promote products derived
iva2k 0:e614f7875b60 46 * from this software without specific prior written permission.
iva2k 0:e614f7875b60 47 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
iva2k 0:e614f7875b60 48 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
iva2k 0:e614f7875b60 49 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
iva2k 0:e614f7875b60 50 *
iva2k 0:e614f7875b60 51 */
iva2k 0:e614f7875b60 52
iva2k 0:e614f7875b60 53 #ifndef AUTH_H
iva2k 0:e614f7875b60 54 #define AUTH_H
iva2k 0:e614f7875b60 55
iva2k 0:e614f7875b60 56 /***********************
iva2k 0:e614f7875b60 57 *** PUBLIC FUNCTIONS ***
iva2k 0:e614f7875b60 58 ***********************/
iva2k 0:e614f7875b60 59
iva2k 0:e614f7875b60 60 /* we are starting to use the link */
iva2k 0:e614f7875b60 61 void link_required (int);
iva2k 0:e614f7875b60 62
iva2k 0:e614f7875b60 63 /* we are finished with the link */
iva2k 0:e614f7875b60 64 void link_terminated (int);
iva2k 0:e614f7875b60 65
iva2k 0:e614f7875b60 66 /* the LCP layer has left the Opened state */
iva2k 0:e614f7875b60 67 void link_down (int);
iva2k 0:e614f7875b60 68
iva2k 0:e614f7875b60 69 /* the link is up; authenticate now */
iva2k 0:e614f7875b60 70 void link_established (int);
iva2k 0:e614f7875b60 71
iva2k 0:e614f7875b60 72 /* a network protocol has come up */
iva2k 0:e614f7875b60 73 void np_up (int, u16_t);
iva2k 0:e614f7875b60 74
iva2k 0:e614f7875b60 75 /* a network protocol has gone down */
iva2k 0:e614f7875b60 76 void np_down (int, u16_t);
iva2k 0:e614f7875b60 77
iva2k 0:e614f7875b60 78 /* a network protocol no longer needs link */
iva2k 0:e614f7875b60 79 void np_finished (int, u16_t);
iva2k 0:e614f7875b60 80
iva2k 0:e614f7875b60 81 /* peer failed to authenticate itself */
iva2k 0:e614f7875b60 82 void auth_peer_fail (int, u16_t);
iva2k 0:e614f7875b60 83
iva2k 0:e614f7875b60 84 /* peer successfully authenticated itself */
iva2k 0:e614f7875b60 85 void auth_peer_success (int, u16_t, char *, int);
iva2k 0:e614f7875b60 86
iva2k 0:e614f7875b60 87 /* we failed to authenticate ourselves */
iva2k 0:e614f7875b60 88 void auth_withpeer_fail (int, u16_t);
iva2k 0:e614f7875b60 89
iva2k 0:e614f7875b60 90 /* we successfully authenticated ourselves */
iva2k 0:e614f7875b60 91 void auth_withpeer_success (int, u16_t);
iva2k 0:e614f7875b60 92
iva2k 0:e614f7875b60 93 /* check authentication options supplied */
iva2k 0:e614f7875b60 94 void auth_check_options (void);
iva2k 0:e614f7875b60 95
iva2k 0:e614f7875b60 96 /* check what secrets we have */
iva2k 0:e614f7875b60 97 void auth_reset (int);
iva2k 0:e614f7875b60 98
iva2k 0:e614f7875b60 99 /* Check peer-supplied username/password */
iva2k 0:e614f7875b60 100 u_char check_passwd (int, char *, int, char *, int, char **, int *);
iva2k 0:e614f7875b60 101
iva2k 0:e614f7875b60 102 /* get "secret" for chap */
iva2k 0:e614f7875b60 103 int get_secret (int, char *, char *, char *, int *, int);
iva2k 0:e614f7875b60 104
iva2k 0:e614f7875b60 105 /* check if IP address is authorized */
iva2k 0:e614f7875b60 106 int auth_ip_addr (int, u32_t);
iva2k 0:e614f7875b60 107
iva2k 0:e614f7875b60 108 /* check if IP address is unreasonable */
iva2k 0:e614f7875b60 109 int bad_ip_adrs (u32_t);
iva2k 0:e614f7875b60 110
iva2k 0:e614f7875b60 111 #endif /* AUTH_H */