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