mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-12-05 22:18:35 +00:00
Macros to simplify tentative parsing.
This commit is contained in:
1 parent
adca3e9c4b
commit
ce2a0f5a6a
1 file changed
+19
@@ -3,6 +3,25 @@
|
|||||||
#include "dnssec-crypto.h"
|
#include "dnssec-crypto.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#define CHECKED_GETCHAR(var, ptr, len) do { \
|
||||||
|
if ((len) < 1) return 0; \
|
||||||
|
var = *ptr++; \
|
||||||
|
(len) -= 1; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define CHECKED_GETSHORT(var, ptr, len) do { \
|
||||||
|
if ((len) < 2) return 0; \
|
||||||
|
GETSHORT(var, ptr); \
|
||||||
|
(len) -= 2; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define CHECKED_GETLONG(var, ptr, len) do { \
|
||||||
|
if ((len) < 4) return 0; \
|
||||||
|
GETLONG(var, ptr); \
|
||||||
|
(len) -= 4; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#define SERIAL_UNDEF -100
|
#define SERIAL_UNDEF -100
|
||||||
#define SERIAL_EQ 0
|
#define SERIAL_EQ 0
|
||||||
#define SERIAL_LT -1
|
#define SERIAL_LT -1
|
||||||
|
|||||||
Reference in new issue
Block a user