X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=blobdiff_plain;f=secnet.h;h=c3cadb9737a0feb03301017c6a04dd0afd4e6e21;hp=4b211f5c687a1e17caf8b7d4dc0057ab72e2a5b3;hb=eaef42b75b51f5d8abebc023fcd66ec76933b613;hpb=fe5e9cc422cd72526ccfceffbc7e5af8ac83b407 diff --git a/secnet.h b/secnet.h index 4b211f5..c3cadb9 100644 --- a/secnet.h +++ b/secnet.h @@ -12,6 +12,21 @@ #include #include +/* + * Macros added by SGT for endianness-independence + */ +#define GET_32BIT_MSB_FIRST(cp) \ + (((unsigned long)(unsigned char)(cp)[0] << 24) | \ + ((unsigned long)(unsigned char)(cp)[1] << 16) | \ + ((unsigned long)(unsigned char)(cp)[2] << 8) | \ + ((unsigned long)(unsigned char)(cp)[3])) + +#define PUT_32BIT_MSB_FIRST(cp, value) ( \ + (cp)[0] = (char)((value) >> 24), \ + (cp)[1] = (char)((value) >> 16), \ + (cp)[2] = (char)((value) >> 8), \ + (cp)[3] = (char)(value) ) + typedef char *string_t; typedef const char *cstring_t; typedef enum {False,True} bool_t; @@ -281,7 +296,7 @@ struct log_if { log_vmsg_fn *vlog; }; /* (convenience function, defined in util.c) */ -extern void log(struct log_if *lf, int class, const char *message, ...) +extern void slilog(struct log_if *lf, int class, const char *message, ...) FORMAT(printf,3,4); /* SITE interface */