4.104.114.84.95
Last change
on this file since d2970aae was
03bd4ae,
checked in by Ralf Corsepius <ralf.corsepius@…>, on 05/16/03 at 08:57:09
|
2003-05-16 Ralf Corsepius <corsepiu@…>
- pppd/magic.c: Remove *rand48.
- pppd/chap.c: Remove prototypes of *rand48.
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Line | |
---|
1 | /* |
---|
2 | * magic.c - PPP Magic Number routines. |
---|
3 | * |
---|
4 | * Copyright (c) 1989 Carnegie Mellon University. |
---|
5 | * All rights reserved. |
---|
6 | * |
---|
7 | * Redistribution and use in source and binary forms are permitted |
---|
8 | * provided that the above copyright notice and this paragraph are |
---|
9 | * duplicated in all such forms and that any documentation, |
---|
10 | * advertising materials, and other materials related to such |
---|
11 | * distribution and use acknowledge that the software was developed |
---|
12 | * by Carnegie Mellon University. The name of the |
---|
13 | * University may not be used to endorse or promote products derived |
---|
14 | * from this software without specific prior written permission. |
---|
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
---|
16 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
---|
17 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
---|
18 | */ |
---|
19 | |
---|
20 | #define RCSID "$Id$" |
---|
21 | |
---|
22 | #include <stdio.h> |
---|
23 | #include <stdlib.h> |
---|
24 | #include <unistd.h> |
---|
25 | #include <sys/types.h> |
---|
26 | #include <sys/time.h> |
---|
27 | |
---|
28 | #include "pppd.h" |
---|
29 | #include "magic.h" |
---|
30 | |
---|
31 | static const char rcsid[] = RCSID; |
---|
32 | |
---|
33 | /* |
---|
34 | * magic_init - Initialize the magic number generator. |
---|
35 | * |
---|
36 | * Attempts to compute a random number seed which will not repeat. |
---|
37 | * The current method uses the current hostid, current process ID |
---|
38 | * and current time, currently. |
---|
39 | */ |
---|
40 | void |
---|
41 | magic_init() |
---|
42 | { |
---|
43 | long seed; |
---|
44 | struct timeval t; |
---|
45 | |
---|
46 | gettimeofday(&t, NULL); |
---|
47 | seed = get_host_seed() ^ t.tv_sec ^ t.tv_usec ^ getpid(); |
---|
48 | srand48(seed); |
---|
49 | } |
---|
50 | |
---|
51 | /* |
---|
52 | * magic - Returns the next magic number. |
---|
53 | */ |
---|
54 | u_int32_t |
---|
55 | magic() |
---|
56 | { |
---|
57 | return (u_int32_t) mrand48(); |
---|
58 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.