From 16720e5ffa2f10c5a969c4027ac570ce46832ea3 Mon Sep 17 00:00:00 2001 From: "Robert S. French" Date: Wed, 10 Jun 1987 08:34:32 +0000 Subject: Initial revision --- lib/ZParseNot.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 lib/ZParseNot.c (limited to 'lib/ZParseNot.c') diff --git a/lib/ZParseNot.c b/lib/ZParseNot.c new file mode 100644 index 0000000..394e89a --- /dev/null +++ b/lib/ZParseNot.c @@ -0,0 +1,60 @@ +/* This file is part of the Project Athena Zephyr Notification System. + * It contains source for the ZParseNotice function. + * + * Created by: Robert French + * + * $Source$ + * $Author$ + * + * Copyright (c) 1987 by the Massachusetts Institute of Technology. + * For copying and distribution information, see the file + * "mit-copyright.h". + */ +/* $Header$ */ + +#include + +#include + +Code_t ZParseNotice(buffer,len,notice,auth) + ZPacket_t buffer; + int len; + ZNotice_t *notice; + int *auth; +{ + int hdrlen; + char *ptr; + + hdrlen = *((short *)buffer); + + ptr = buffer+2; + + if (*ptr++ != ZVERSION) + return (ZERR_VERS); + + notice->z_kind = (ZNotice_Kind_t)*ptr++; + bcopy(ptr,notice->z_checksum,sizeof(ZChecksum_t)); + ptr += sizeof(ZChecksum_t); + bcopy(ptr,¬ice->z_uid,sizeof(ZUnique_Id_t)); + ptr += sizeof(ZUnique_Id_t); + notice->z_port = *((short *)ptr); + ptr += sizeof(short); + notice->z_class = ptr; + ptr += strlen(ptr)+1; + notice->z_class_inst = ptr; + ptr += strlen(ptr)+1; + notice->z_opcode = ptr; + ptr += strlen(ptr)+1; + notice->z_sender = ptr; + ptr += strlen(ptr)+1; + notice->z_recipient = ptr; + ptr += strlen(ptr)+1; + + if (ptr-buffer != hdrlen) + return(ZERR_BADPKT); + + notice->z_message = (caddr_t) ptr; + notice->z_message_len = len-hdrlen; + + *auth = 0; +} -- cgit v1.2.3