annotate reserved.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1 /* $Id: reserved.c,v 1.1.1.1 1997/12/06 05:41:30 darius Exp $ */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
3 /* reserved.c
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
4
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
5 * Kevin P. Smith 7/3/89
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
6 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
7 #include "copyright2.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
8 #include <stdio.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
9 #include <sys/types.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
10 #include <sys/socket.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
11 #include <netinet/in.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
12 #include <netdb.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
13 #include "defs.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
14 #include "packets.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
15
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
16 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
17 makeReservedPacket(packet)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
18 struct reserved_spacket *packet;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
19 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
20 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
21
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
22 for (i = 0; i < 16; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
23 packet->data[i] = random() % 256;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
24 } packet->type = SP_RESERVED;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
25 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
26
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
27 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
28 encryptReservedPacket(spacket, cpacket, server, pno)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
29 struct reserved_spacket *spacket;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
30 struct reserved_cpacket *cpacket;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
31 char *server;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
32 int pno;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
33 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
34
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
35 memcpy(cpacket->data, spacket->data, 16);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
36 memcpy(cpacket->resp, spacket->data, 16);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
37 cpacket->type = CP_RESERVED;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
38
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
39 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
40 Encryption algorithm goes here. Take the 16 bytes in cpacket->data,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
41 and create cpacket->resp, which you require the client to also do. If
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
42 he fails, he gets kicked out.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
43 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
44 }