return false;
}
- if ( nh->unk2!=0 ) {
- return false;
- }
-
- if ( *(unsigned short*)nh->unk3!=0 ) {
+ if ( *(unsigned short*)nh->unk2!=0 ) {
return false;
}
return false;
}
- if ( *(unsigned int*)nh->unk4!=0 ) {
+ if ( *(unsigned int*)nh->unk3!=0 ) {
return false;
}
+// ---------------------------------------------------------
+struct attr* newShortAttr (unsigned short attr, short value) {
+
+ short *v=malloc(sizeof(short));
+
+ *v=value;
+
+ return newAttr(attr, sizeof(short), v);
+
+}
+
+
+
// -----------------------------------------------------
struct attr* newIntAttr (unsigned short attr, int value) {
+// -----------------------------------------------------------------
+struct attr* newAddrAttr (unsigned short attr, struct in_addr value) {
+
+ struct in_addr *v=malloc(sizeof(struct in_addr));
+
+ *v=value;
+
+ return newAttr(attr, sizeof(struct in_addr), v);
+
+}
+
+
+
// ----------------------------
void freeAttr (struct attr *at) {
-// -----------------------------------------------------------------------------------------------------
-void extractPacketAttributes (struct ng_packet *np, char *error, unsigned short *attr_error, List *attr) {
+// ---------------------------------------------------------------------------------------------------------------
+void extractPacketAttributes (struct ng_packet *np, unsigned short *error, unsigned short *attr_error, List *attr) {
struct attr *at;
- if ( error!=NULL ) {
- *error=np->nh->error;
- }
-
- if ( attr_error!=NULL ) {
- *attr_error=ntohs(np->nh->attr);
- }
+ if ( error!=NULL ) *error=ntohs(np->nh->error);
+ if ( attr_error!=NULL ) *attr_error=ntohs(np->nh->attr);
while ( getPacketTotalSize(np)<np->maxlen ) {