-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f423245
commit 6adfd81
Showing
7 changed files
with
145 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Part of DNS zone file validator `validns`. | ||
* | ||
* Copyright 2016 Pieter Lexis <[email protected]> | ||
* Modified BSD license. | ||
* (See LICENSE file in the distribution.) | ||
* | ||
*/ | ||
#include <sys/types.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <netinet/in.h> | ||
#include <arpa/inet.h> | ||
|
||
#include "common.h" | ||
#include "textparse.h" | ||
#include "mempool.h" | ||
#include "carp.h" | ||
#include "rr.h" | ||
|
||
static struct rr* eui48_parse(char *name, long ttl, int type, char *s) | ||
{ | ||
struct rr_eui48 *rr = getmem(sizeof(*rr)); | ||
uint8_t r[6]; | ||
|
||
if (sscanf(s, "%2hhx-%2hhx-%2hhx-%2hhx-%2hhx-%2hhx", | ||
r, r+1, r+2, r+3, r+4, r+5) != 6) { | ||
return bitch("%s: in wrong format", name); | ||
} | ||
|
||
memmove(rr->address, r, 6); | ||
|
||
return store_record(type, name, ttl, rr); | ||
} | ||
|
||
static struct binary_data eui48_wirerdata(struct rr *rrv) | ||
{ | ||
RRCAST(eui48); | ||
struct binary_data r; | ||
|
||
r.length = sizeof(rr->address); | ||
r.data = (void *)&rr->address; | ||
|
||
return r; | ||
} | ||
|
||
static char* eui48_human(struct rr *rrv) | ||
{ | ||
return "..."; | ||
} | ||
|
||
struct rr_methods eui48_methods = { eui48_parse, eui48_human, eui48_wirerdata, NULL, NULL }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Part of DNS zone file validator `validns`. | ||
* | ||
* Copyright 2016 Pieter Lexis <[email protected]> | ||
* Modified BSD license. | ||
* (See LICENSE file in the distribution.) | ||
* | ||
*/ | ||
#include <sys/types.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <netinet/in.h> | ||
#include <arpa/inet.h> | ||
|
||
#include "common.h" | ||
#include "textparse.h" | ||
#include "mempool.h" | ||
#include "carp.h" | ||
#include "rr.h" | ||
|
||
static struct rr* eui64_parse(char *name, long ttl, int type, char *s) | ||
{ | ||
struct rr_eui64 *rr = getmem(sizeof(*rr)); | ||
uint8_t r[8]; | ||
|
||
if (sscanf(s, "%2hhx-%2hhx-%2hhx-%2hhx-%2hhx-%2hhx-%2hhx-%2hhx", | ||
r+0, r+1, r+2, r+3, r+4, r+5, r+6, r+7) != 8) { | ||
return bitch("%s: in wrong format", name); | ||
} | ||
|
||
memmove(rr->address, r, 8); | ||
|
||
return store_record(type, name, ttl, rr); | ||
} | ||
|
||
static struct binary_data eui64_wirerdata(struct rr *rrv) | ||
{ | ||
RRCAST(eui64); | ||
struct binary_data r; | ||
|
||
r.length = sizeof(rr->address); | ||
r.data = (void *)&rr->address; | ||
|
||
return r; | ||
} | ||
|
||
static char* eui64_human(struct rr *rrv) | ||
{ | ||
return "..."; | ||
} | ||
|
||
struct rr_methods eui64_methods = { eui64_parse, eui64_human, eui64_wirerdata, NULL, NULL }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters