view reserved.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
line wrap: on
line source

/* $Id: reserved.c,v 1.1.1.1 1997/12/06 05:41:30 darius Exp $ */

/* reserved.c

 * Kevin P. Smith   7/3/89
 */
#include "copyright2.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include "defs.h"
#include "packets.h"

void
makeReservedPacket(packet)
    struct reserved_spacket *packet;
{
    int     i;

    for (i = 0; i < 16; i++) {
	packet->data[i] = random() % 256;
    } packet->type = SP_RESERVED;
}

void
encryptReservedPacket(spacket, cpacket, server, pno)
    struct reserved_spacket *spacket;
    struct reserved_cpacket *cpacket;
    char   *server;
    int     pno;
{

    memcpy(cpacket->data, spacket->data, 16);
    memcpy(cpacket->resp, spacket->data, 16);
    cpacket->type = CP_RESERVED;

    /*
       Encryption algorithm goes here. Take the 16 bytes in cpacket->data,
       and create cpacket->resp, which you require the client to also do.  If
       he fails, he gets kicked out.
    */
}