MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / dns_ebl_parser

Function dns_ebl_parser

resolve.c:1029–1069  ·  view source on GitHub ↗

! \brief parses a EBL record into a ebl_rdata structure * * EBL Record * * 0 1 2 3 4 5 6 7 * +--+--+--+--+--+--+--+--+ * | POSITION | * +--+--+--+--+--+--+--+--+ * / SEPARATOR / * +--+--+--+--+--+--+--+--+ * / APEX / * +--+--+--+--+--+--+--+--+ */

Source from the content-addressed store, hash-verified

1027 * +--+--+--+--+--+--+--+--+
1028 */
1029struct ebl_rdata* dns_ebl_parser( unsigned char* msg, unsigned char* end,
1030 unsigned char* rdata)
1031{
1032 struct ebl_rdata* ebl;
1033 int len;
1034
1035 ebl=0;
1036 ebl=(struct ebl_rdata*)local_malloc(sizeof(struct ebl_rdata));
1037 if(ebl==0){
1038 LM_ERR("out of pkg memory\n");
1039 goto error;
1040 }
1041
1042 len = *rdata;
1043 if (rdata + 1 + len >= end)
1044 goto error; /* something fishy in the record */
1045
1046 ebl->position = *rdata;
1047 if ( ebl->position > 15 )
1048 goto error; /* doesn't make sense: E.164 numbers can't be longer */
1049
1050 rdata++;
1051
1052 ebl->separator_len = (int) *rdata;
1053 rdata++;
1054 if ((rdata + 1 + ebl->separator_len) >= end)
1055 goto error;
1056 memcpy((void*)&ebl->separator, rdata, ebl->separator_len);
1057 rdata += ebl->separator_len;
1058
1059 ebl->apex_len=dn_expand(msg, end, rdata, ebl->apex, MAX_DNS_NAME-1);
1060 if ( ebl->apex_len==(unsigned int)-1 )
1061 goto error;
1062 ebl->apex[ebl->apex_len] = 0; /* 0-terminate string */
1063 return ebl;
1064
1065error:
1066 if (ebl)
1067 local_free(ebl);
1068 return 0;
1069}
1070
1071
1072

Callers 1

get_recordFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected