Example self-announcing webserver which controls a servo through a smallHTML userinterface.

Dependencies:   mbed

Committer:
dirkx
Date:
Sat Aug 14 15:56:01 2010 +0000
Revision:
0:a259777c45a3

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dirkx 0:a259777c45a3 1 /*****************************************************************************
dirkx 0:a259777c45a3 2 * randm.h - Random number generator header file.
dirkx 0:a259777c45a3 3 *
dirkx 0:a259777c45a3 4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
dirkx 0:a259777c45a3 5 * Copyright (c) 1998 Global Election Systems Inc.
dirkx 0:a259777c45a3 6 *
dirkx 0:a259777c45a3 7 * The authors hereby grant permission to use, copy, modify, distribute,
dirkx 0:a259777c45a3 8 * and license this software and its documentation for any purpose, provided
dirkx 0:a259777c45a3 9 * that existing copyright notices are retained in all copies and that this
dirkx 0:a259777c45a3 10 * notice and the following disclaimer are included verbatim in any
dirkx 0:a259777c45a3 11 * distributions. No written agreement, license, or royalty fee is required
dirkx 0:a259777c45a3 12 * for any of the authorized uses.
dirkx 0:a259777c45a3 13 *
dirkx 0:a259777c45a3 14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
dirkx 0:a259777c45a3 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
dirkx 0:a259777c45a3 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
dirkx 0:a259777c45a3 17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
dirkx 0:a259777c45a3 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
dirkx 0:a259777c45a3 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
dirkx 0:a259777c45a3 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
dirkx 0:a259777c45a3 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
dirkx 0:a259777c45a3 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
dirkx 0:a259777c45a3 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dirkx 0:a259777c45a3 24 *
dirkx 0:a259777c45a3 25 ******************************************************************************
dirkx 0:a259777c45a3 26 * REVISION HISTORY
dirkx 0:a259777c45a3 27 *
dirkx 0:a259777c45a3 28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
dirkx 0:a259777c45a3 29 * Ported to lwIP.
dirkx 0:a259777c45a3 30 * 98-05-29 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
dirkx 0:a259777c45a3 31 * Extracted from avos.
dirkx 0:a259777c45a3 32 *****************************************************************************/
dirkx 0:a259777c45a3 33
dirkx 0:a259777c45a3 34 #ifndef RANDM_H
dirkx 0:a259777c45a3 35 #define RANDM_H
dirkx 0:a259777c45a3 36
dirkx 0:a259777c45a3 37 /***********************
dirkx 0:a259777c45a3 38 *** PUBLIC FUNCTIONS ***
dirkx 0:a259777c45a3 39 ***********************/
dirkx 0:a259777c45a3 40 /*
dirkx 0:a259777c45a3 41 * Initialize the random number generator.
dirkx 0:a259777c45a3 42 */
dirkx 0:a259777c45a3 43 void avRandomInit(void);
dirkx 0:a259777c45a3 44
dirkx 0:a259777c45a3 45 /*
dirkx 0:a259777c45a3 46 * Churn the randomness pool on a random event. Call this early and often
dirkx 0:a259777c45a3 47 * on random and semi-random system events to build randomness in time for
dirkx 0:a259777c45a3 48 * usage. For randomly timed events, pass a null pointer and a zero length
dirkx 0:a259777c45a3 49 * and this will use the system timer and other sources to add randomness.
dirkx 0:a259777c45a3 50 * If new random data is available, pass a pointer to that and it will be
dirkx 0:a259777c45a3 51 * included.
dirkx 0:a259777c45a3 52 */
dirkx 0:a259777c45a3 53 void avChurnRand(char *randData, u32_t randLen);
dirkx 0:a259777c45a3 54
dirkx 0:a259777c45a3 55 /*
dirkx 0:a259777c45a3 56 * Randomize our random seed value. To be called for truely random events
dirkx 0:a259777c45a3 57 * such as user operations and network traffic.
dirkx 0:a259777c45a3 58 */
dirkx 0:a259777c45a3 59 #if MD5_SUPPORT
dirkx 0:a259777c45a3 60 #define avRandomize() avChurnRand(NULL, 0)
dirkx 0:a259777c45a3 61 #else /* MD5_SUPPORT */
dirkx 0:a259777c45a3 62 void avRandomize(void);
dirkx 0:a259777c45a3 63 #endif /* MD5_SUPPORT */
dirkx 0:a259777c45a3 64
dirkx 0:a259777c45a3 65 /*
dirkx 0:a259777c45a3 66 * Use the random pool to generate random data. This degrades to pseudo
dirkx 0:a259777c45a3 67 * random when used faster than randomness is supplied using churnRand().
dirkx 0:a259777c45a3 68 * Thus it's important to make sure that the results of this are not
dirkx 0:a259777c45a3 69 * published directly because one could predict the next result to at
dirkx 0:a259777c45a3 70 * least some degree. Also, it's important to get a good seed before
dirkx 0:a259777c45a3 71 * the first use.
dirkx 0:a259777c45a3 72 */
dirkx 0:a259777c45a3 73 void avGenRand(char *buf, u32_t bufLen);
dirkx 0:a259777c45a3 74
dirkx 0:a259777c45a3 75 /*
dirkx 0:a259777c45a3 76 * Return a new random number.
dirkx 0:a259777c45a3 77 */
dirkx 0:a259777c45a3 78 u32_t avRandom(void);
dirkx 0:a259777c45a3 79
dirkx 0:a259777c45a3 80
dirkx 0:a259777c45a3 81 #endif /* RANDM_H */