Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers magic.h Source File

magic.h

00001 /*
00002  * magic.h - PPP Magic Number definitions.
00003  *
00004  * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  *
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in
00015  *    the documentation and/or other materials provided with the
00016  *    distribution.
00017  *
00018  * 3. The name "Carnegie Mellon University" must not be used to
00019  *    endorse or promote products derived from this software without
00020  *    prior written permission. For permission or any legal
00021  *    details, please contact
00022  *      Office of Technology Transfer
00023  *      Carnegie Mellon University
00024  *      5000 Forbes Avenue
00025  *      Pittsburgh, PA  15213-3890
00026  *      (412) 268-4387, fax: (412) 268-7395
00027  *      tech-transfer@andrew.cmu.edu
00028  *
00029  * 4. Redistributions of any form whatsoever must retain the following
00030  *    acknowledgment:
00031  *    "This product includes software developed by Computing Services
00032  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
00033  *
00034  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
00035  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00036  * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
00037  * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00038  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
00039  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
00040  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00041  *
00042  * $Id: magic.h,v 1.5 2003/06/11 23:56:26 paulus Exp $
00043  */
00044 /*****************************************************************************
00045 * randm.h - Random number generator header file.
00046 *
00047 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
00048 * Copyright (c) 1998 Global Election Systems Inc.
00049 *
00050 * The authors hereby grant permission to use, copy, modify, distribute,
00051 * and license this software and its documentation for any purpose, provided
00052 * that existing copyright notices are retained in all copies and that this
00053 * notice and the following disclaimer are included verbatim in any
00054 * distributions. No written agreement, license, or royalty fee is required
00055 * for any of the authorized uses.
00056 *
00057 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
00058 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00059 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00060 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00061 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00062 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00063 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00064 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00065 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00066 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00067 *
00068 ******************************************************************************
00069 * REVISION HISTORY
00070 *
00071 * 03-01-01 Marc Boucher <marc@mbsi.ca>
00072 *   Ported to lwIP.
00073 * 98-05-29 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
00074 *   Extracted from avos.
00075 *****************************************************************************/
00076 
00077 #include "netif/ppp/ppp_opts.h"
00078 #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
00079 
00080 #ifndef MAGIC_H
00081 #define MAGIC_H
00082 
00083 /***********************
00084 *** PUBLIC FUNCTIONS ***
00085 ***********************/
00086 
00087 /*
00088  * Initialize the random number generator.
00089  */
00090 void magic_init(void);
00091 
00092 /*
00093  * Randomize our random seed value.  To be called for truely random events
00094  * such as user operations and network traffic.
00095  */
00096 void magic_randomize(void);
00097 
00098 /*
00099  * Return a new random number.
00100  */
00101 u32_t magic(void);  /* Returns the next magic number */
00102 
00103 /*
00104  * Fill buffer with random bytes
00105  *
00106  * Use the random pool to generate random data.  This degrades to pseudo
00107  * random when used faster than randomness is supplied using magic_churnrand().
00108  * Thus it's important to make sure that the results of this are not
00109  * published directly because one could predict the next result to at
00110  * least some degree.  Also, it's important to get a good seed before
00111  * the first use.
00112  */
00113 void magic_random_bytes(unsigned char *buf, u32_t buf_len);
00114 
00115 /*
00116  * Return a new random number between 0 and (2^pow)-1 included.
00117  */
00118 u32_t magic_pow(u8_t pow);
00119 
00120 #endif /* MAGIC_H */
00121 
00122 #endif /* PPP_SUPPORT */