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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers auth.h Source File

auth.h

00001 /*****************************************************************************
00002 * auth.h -  PPP Authentication and phase control header file.
00003 *
00004 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
00005 * portions Copyright (c) 1998 Global Election Systems Inc.
00006 *
00007 * The authors hereby grant permission to use, copy, modify, distribute,
00008 * and license this software and its documentation for any purpose, provided
00009 * that existing copyright notices are retained in all copies and that this
00010 * notice and the following disclaimer are included verbatim in any 
00011 * distributions. No written agreement, license, or royalty fee is required
00012 * for any of the authorized uses.
00013 *
00014 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
00015 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00016 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
00017 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00018 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00019 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00020 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00021 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00022 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00023 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00024 *
00025 ******************************************************************************
00026 * REVISION HISTORY
00027 *
00028 * 03-01-01 Marc Boucher <marc@mbsi.ca>
00029 *   Ported to lwIP.
00030 * 97-12-04 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
00031 *   Original derived from BSD pppd.h.
00032 *****************************************************************************/
00033 /*
00034  * pppd.h - PPP daemon global declarations.
00035  *
00036  * Copyright (c) 1989 Carnegie Mellon University.
00037  * All rights reserved.
00038  *
00039  * Redistribution and use in source and binary forms are permitted
00040  * provided that the above copyright notice and this paragraph are
00041  * duplicated in all such forms and that any documentation,
00042  * advertising materials, and other materials related to such
00043  * distribution and use acknowledge that the software was developed
00044  * by Carnegie Mellon University.  The name of the
00045  * University may not be used to endorse or promote products derived
00046  * from this software without specific prior written permission.
00047  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
00048  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
00049  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00050  *
00051  */
00052 
00053 #ifndef AUTH_H
00054 #define AUTH_H
00055 
00056 /***********************
00057 *** PUBLIC FUNCTIONS ***
00058 ***********************/
00059 
00060 /* we are starting to use the link */
00061 void link_required (int);
00062 
00063 /* we are finished with the link */
00064 void link_terminated (int);
00065 
00066 /* the LCP layer has left the Opened state */
00067 void link_down (int);
00068 
00069 /* the link is up; authenticate now */
00070 void link_established (int);
00071 
00072 /* a network protocol has come up */
00073 void np_up (int, u16_t);
00074 
00075 /* a network protocol has gone down */
00076 void np_down (int, u16_t);
00077 
00078 /* a network protocol no longer needs link */
00079 void np_finished (int, u16_t);
00080 
00081 /* peer failed to authenticate itself */
00082 void auth_peer_fail (int, u16_t);
00083 
00084 /* peer successfully authenticated itself */
00085 void auth_peer_success (int, u16_t, char *, int);
00086 
00087 /* we failed to authenticate ourselves */
00088 void auth_withpeer_fail (int, u16_t);
00089 
00090 /* we successfully authenticated ourselves */
00091 void auth_withpeer_success (int, u16_t);
00092 
00093 /* check authentication options supplied */
00094 void auth_check_options (void);
00095 
00096 /* check what secrets we have */
00097 void auth_reset (int);
00098 
00099 /* Check peer-supplied username/password */
00100 u_char check_passwd (int, char *, int, char *, int, char **, int *);
00101 
00102 /* get "secret" for chap */
00103 int  get_secret (int, char *, char *, char *, int *, int);
00104 
00105 /* check if IP address is authorized */
00106 int  auth_ip_addr (int, u32_t);
00107 
00108 /* check if IP address is unreasonable */
00109 int  bad_ip_adrs (u32_t);
00110 
00111 #endif /* AUTH_H */