123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- #ifndef PLC_SOURCE
- #define PLC_SOURCE
- #include "../plc/plc.h"
- #include "../ether/channel.h"
- struct plc plc =
- {
- (struct channel *) (& channel),
- (struct message *) (0),
- (void *) (0),
- 0,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- },
- {
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- },
- {
- 0x50,
- 0xD3,
- 0xE4,
- 0x93,
- 0x3F,
- 0x85,
- 0x5B,
- 0x70,
- 0x40,
- 0x78,
- 0x4D,
- 0xF8,
- 0x15,
- 0xAA,
- 0x8D,
- 0xB7
- },
- {
- 0x68,
- 0x9F,
- 0x07,
- 0x4B,
- 0x8B,
- 0x02,
- 0x75,
- 0xA2,
- 0x71,
- 0x0B,
- 0x0B,
- 0x57,
- 0x79,
- 0xAD,
- 0x16,
- 0x30
- },
- {
- (file_t) (-1),
- (char const *) (0)
- },
- {
- (file_t) (-1),
- (char const *) (0)
- },
- {
- (file_t) (-1),
- (char const *) (0)
- },
- {
- (file_t) (-1),
- (char const *) (0)
- },
- {
- (file_t) (-1),
- (char const *) (0)
- },
- {
- (file_t) (-1),
- (char const *) (0)
- },
- {
- (file_t) (-1),
- (char const *) (0)
- },
- {
- (file_t) (-1),
- (char const *) (0)
- },
- {
- (file_t) (-1),
- (char const *) (0)
- },
- {
- (file_t) (-1),
- (char const *) (0)
- },
- {
- (file_t) (-1),
- (char const *) (0)
- },
- HARDWAREID,
- SOFTWAREID,
- PLCSESSION,
- HOSTACTION,
- SECTORCODE,
- MODULECODE,
- PUSHBUTTON,
- READACTION,
- PLCOUPLING,
- FLASH_SIZE,
- PLC_STATE,
- PLC_TIMER,
- PLC_SLEEP,
- PLC_COUNT,
- PLC_INDEX,
- PLC_FLAGS,
- PLC_FLAGS
- };
- #if defined (__linux__) || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__) || defined (__FreeBSD__)
- #define RANDOMIZE_COOKIE 1
- #endif
- #ifdef RANDOMIZE_COOKIE
- {
- int f;
- f = open("/dev/urandom", O_BINARY|O_RDONLY);
- if (f >= 0) {
- do {
- read(f, &plc.cookie, sizeof plc.cookie);
- } while (plc.cookie == PLCSESSION || plc.cookie == 0 || plc.cookie == 0xFFFFFFFF);
- close(f);
- }
- }
- #endif
- #endif
|