Replace DEBUG_DNAVARS with DEBUG_RHIZOME_RX

Delete some obsolete HLR code
Mark DEBUG_HLR as deprecated
This commit is contained in:
Andrew Bettison 2012-07-12 16:26:37 +09:30
parent 208a95a233
commit 025ccad810
3 changed files with 3 additions and 106 deletions

2
log.c
View File

@ -229,7 +229,6 @@ unsigned int debugFlagMask(const char *flagname) {
else if (!strcasecmp(flagname,"dnaresponses")) return DEBUG_DNARESPONSES;
else if (!strcasecmp(flagname,"dnarequests")) return DEBUG_DNAREQUESTS;
else if (!strcasecmp(flagname,"simulation")) return DEBUG_SIMULATION;
else if (!strcasecmp(flagname,"dnavars")) return DEBUG_DNAVARS;
else if (!strcasecmp(flagname,"packetformats")) return DEBUG_PACKETFORMATS;
else if (!strcasecmp(flagname,"packetconstruction")) return DEBUG_PACKETCONSTRUCTION;
else if (!strcasecmp(flagname,"gateway")) return DEBUG_GATEWAY;
@ -241,6 +240,7 @@ unsigned int debugFlagMask(const char *flagname) {
else if (!strcasecmp(flagname,"security")) return DEBUG_SECURITY;
else if (!strcasecmp(flagname,"rhizome")) return DEBUG_RHIZOME;
else if (!strcasecmp(flagname,"rhizomesync")) return DEBUG_RHIZOMESYNC;
else if (!strcasecmp(flagname,"rhizomerx")) return DEBUG_RHIZOME_RX;
else if (!strcasecmp(flagname,"monitorroutes")) return DEBUG_OVERLAYROUTEMONITOR;
else if (!strcasecmp(flagname,"queues")) return DEBUG_QUEUES;
else if (!strcasecmp(flagname,"broadcasts")) return DEBUG_BROADCASTS;

View File

@ -277,104 +277,6 @@ int packetFinalise(unsigned char *packet,int packet_maxlen,int recvttl,
return 0;
}
int packetAddHLRCreateRequest(unsigned char *packet,int packet_maxlen,int *packet_len)
{
int packet_len_in=*packet_len;
CHECK_PACKET_LEN(1);
packet[(*packet_len)++]=ACTION_CREATEHLR;
if (debug&(DEBUG_HLR|DEBUG_PACKETFORMATS)) dump("Variable request octets (HLR create)",&packet[packet_len_in],(*packet_len)-packet_len_in);
return 0;
}
int packetAddVariableRequest(unsigned char *packet,int packet_maxlen,int *packet_len,
char *item,int instance,int start_offset,int bytes)
{
/* Work out which item type we are asking for */
int itemId;
int packet_len_in=*packet_len;
for(itemId=0;vars[itemId].name;itemId++)
if (!strcmp(item,vars[itemId].name)) {
break;
}
/* Sanity check the request */
if (!vars[itemId].name) {
if (debug&(DEBUG_DNAVARS|DEBUG_PACKETFORMATS)) fprintf(stderr,"`%s' is not a known HLR variable.\n",item);
return WHY("Requested unknown HLR variable");
}
itemId=vars[itemId].id;
if (instance<-1) return WHY("Asked for illegal variable value instance (<-1)");
if (instance>0xfe) return WHY("Asked for illegal variable value instance (>0xfe)");
if ((instance!=-1)&&(itemId<0x80)&&instance) {
return WHY("Asked for secondary value of single-value variable for read");
}
if (start_offset<0||start_offset>0xffff) return WHY("Asked for illegal variable value starting offset");
if (bytes<0||(start_offset+bytes)>0xffff) {
if (debug&(DEBUG_PACKETFORMATS|DEBUG_DNAVARS)) fprintf(stderr,"Asked for %d bytes at offset %d\n",bytes,start_offset);
return WHY("Asked for illegal variable value ending offset");
}
/* Add request to the packet */
CHECK_PACKET_LEN(1+1+((itemId&0x80)?1:0)+2+2);
packet[(*packet_len)++]=ACTION_GET;
packet[(*packet_len)++]=itemId;
if (itemId&0x80) { packet[(*packet_len)++]=instance; }
packet[(*packet_len)++]=start_offset>>8;
packet[(*packet_len)++]=start_offset&0xff;
packet[(*packet_len)++]=bytes>>8;
packet[(*packet_len)++]=bytes&0xff;
if (debug&DEBUG_PACKETFORMATS) dump("Variable request octets (var)",&packet[packet_len_in],(*packet_len)-packet_len_in);
return 0;
}
int packetAddVariableWrite(unsigned char *packet,int packet_maxlen,
int *packet_len,
int itemId,int instance,unsigned char *value,
int start_offset,int value_len,int flags)
{
/* Work out which item type we are asking for */
int packet_len_in=*packet_len;
int max_offset=start_offset+value_len-1;
if (debug&DEBUG_PACKETFORMATS) printf("packetAddVariableWrite(start=%d,len=%d,flags=%d)\n",start_offset,value_len,flags);
/* Sanity check */
if (itemId&0x80) {
if (instance<0) return WHY("Asked for illegal variable value instance (<0)");
if (instance>0xfe) return WHY("Asked for illegal variable value instance (>0xfe)");
}
if ((itemId<0x80)&&instance&&(instance!=-1)) return WHY("Asked for secondary value of single-value variable for write");
if (start_offset<0||start_offset>0xffff) return WHY("Asked for illegal variable value starting offset");
if (max_offset<0||max_offset>0xffff) return WHY("Asked for illegal variable value ending offset");
/* Add request to the packet */
CHECK_PACKET_LEN(1+1+((itemId&0x80)?1:0)+2+2+1);
packet[(*packet_len)++]=ACTION_SET;
packet[(*packet_len)++]=itemId;
if (itemId&0x80) packet[(*packet_len)++]=instance;
packet[(*packet_len)++]=start_offset>>8;
packet[(*packet_len)++]=start_offset&0xff;
packet[(*packet_len)++]=value_len>>8;
packet[(*packet_len)++]=value_len&0xff;
packet[(*packet_len)++]=flags;
if (debug&DEBUG_PACKETFORMATS) dump("Packet with var write header",&packet[0],*packet_len);
CHECK_PACKET_LEN(value_len);
bcopy(&value[0],&packet[*packet_len],value_len);
(*packet_len)+=value_len;
if (debug&DEBUG_PACKETFORMATS) dump("Variable request octets (write)",&packet[packet_len_in],(*packet_len)-packet_len_in);
return 0;
}
int extractRequest(unsigned char *packet,int *packet_ofs,int packet_len,
int *itemId,int *instance,unsigned char *value,
int *start_offset,int *bytes,int *flags)

View File

@ -717,10 +717,7 @@ int packetSetSidFromId(unsigned char *packet,int packet_maxlen,int *packet_len,
keyring_identity *id);
int packetFinalise(unsigned char *packet,int packet_maxlen,int recvttl,
int *packet_len,int cryptoflags);
int packetAddHLRCreateRequest(unsigned char *packet,int packet_maxlen,int *packet_len);
int extractResponses(struct in_addr sender,unsigned char *buffer,int len,struct response_set *responses);
int packetAddVariableRequest(unsigned char *packet,int packet_maxlen,int *packet_len,
char *item,int instance,int start_offset,int max_offset);
int packetGetID(unsigned char *packet,int len,char *did,char *sid);
int getPeerList();
int sendToPeers(unsigned char *packet,int packet_len,int method,int peerId,struct response_set *responses);
@ -738,8 +735,6 @@ int hlrSetVariable(unsigned char *hlr,int hofs,int varid,int varinstance,
unsigned char *value,int len);
int extractDid(unsigned char *packet,int *ofs,char *did);
char *hlrSid(unsigned char *hlr, int ofs, char *sid);
int packetAddVariableWrite(unsigned char *packet,int packet_maxlen,int *packet_len,
int itemId,int instance,unsigned char *value,int start_offset,int value_len,int flags);
int processRequest(unsigned char *packet,int len,struct sockaddr *sender,int sender_len,
unsigned char *transaction_id,int recvttl,char *did,char *sid);
@ -1093,10 +1088,10 @@ int overlay_saw_mdp_containing_frame(overlay_frame *f,long long now);
#define DEBUG_DNARESPONSES (1 << 5)
#define DEBUG_DNAREQUESTS (1 << 6)
#define DEBUG_SIMULATION (1 << 7)
#define DEBUG_DNAVARS (1 << 8)
#define DEBUG_RHIZOME_RX (1 << 8)
#define DEBUG_PACKETFORMATS (1 << 9)
#define DEBUG_GATEWAY (1 << 10)
#define DEBUG_HLR (1 << 11)
#define DEBUG_HLR (1 << 11) // Deprecated, TODO: delete
#define DEBUG_IO (1 << 12)
#define DEBUG_OVERLAYFRAMES (1 << 13)
#define DEBUG_OVERLAYABBREVIATIONS (1 << 14)