plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

convM2TR.c (617B)


      1 #include <u.h>
      2 #include <libc.h>
      3 #include <authsrv.h>
      4 
      5 #define	CHAR(x)		f->x = *p++
      6 #define	SHORT(x)	f->x = (p[0] | (p[1]<<8)); p += 2
      7 #define	VLONG(q)	q = (p[0] | (p[1]<<8) | (p[2]<<16) | (p[3]<<24)); p += 4
      8 #define	LONG(x)		VLONG(f->x)
      9 #define	STRING(x,n)	memmove(f->x, p, n); p += n
     10 
     11 void
     12 convM2TR(char *ap, Ticketreq *f)
     13 {
     14 	uchar *p;
     15 
     16 	p = (uchar*)ap;
     17 	CHAR(type);
     18 	STRING(authid, ANAMELEN);
     19 	f->authid[ANAMELEN-1] = 0;
     20 	STRING(authdom, DOMLEN);
     21 	f->authdom[DOMLEN-1] = 0;
     22 	STRING(chal, CHALLEN);
     23 	STRING(hostid, ANAMELEN);
     24 	f->hostid[ANAMELEN-1] = 0;
     25 	STRING(uid, ANAMELEN);
     26 	f->uid[ANAMELEN-1] = 0;
     27 	USED(p);
     28 }