Browse code

- Support for dstip and dstport in the parameter parser

Jan Janak authored on 26/02/2005 15:27:03
Showing 2 changed files
... ...
@@ -144,7 +144,21 @@ static inline void parse_uri_class(param_hooks_t* _h, param_t* _p)
144 144
 			_h->uri.maddr = _p;
145 145
 		}
146 146
 		break;
147
+		
148
+	case 'd':
149
+	case 'D':
150
+		if ((_p->name.len == 5) &&
151
+		    (!strncasecmp(_p->name.s + 1, "stip", 4))) {
152
+			_p->type = P_DSTIP;
153
+			_h->uri.dstip = _p;
154
+		} else if ((_p->name.len == 7) &&
155
+			   (!strncasecmp(_p->name.s + 1, "stport", 6))) {
156
+			_p->type = P_DSTPORT;
157
+			_h->uri.dstport = _p;
158
+		}
159
+		break;
147 160
 	}
161
+
148 162
 }
149 163
 
150 164
 
... ...
@@ -475,6 +489,8 @@ static inline void print_param(FILE* _o, param_t* _p)
475 489
 	case P_MADDR:     type = "P_MADDR";     break;
476 490
 	case P_TTL:       type = "P_TTL";       break;
477 491
 	case P_RECEIVED:  type = "P_RECEIVED";  break;
492
+	case P_DSTIP:     type = "P_DSTIP";     break;
493
+	case P_DSTPORT:   type = "P_DSTPORT";   break;
478 494
 	default:          type = "UNKNOWN";     break;
479 495
 	}
480 496
 	
... ...
@@ -53,6 +53,8 @@ typedef enum ptype {
53 53
 	P_R2,        /* URI: r2 parameter (ser specific) */
54 54
 	P_MADDR,     /* URI: maddr parameter */
55 55
 	P_TTL,       /* URI: ttl parameter */
56
+	P_DSTIP,     /* URI: dstip parameter */
57
+	P_DSTPORT,   /* URi: dstport parameter */
56 58
 } ptype_t;
57 59
 
58 60
 
... ...
@@ -98,6 +100,8 @@ struct uri_hooks {
98 100
 	struct param* r2;        /* r2 parameter */
99 101
 	struct param* maddr;     /* maddr parameter */
100 102
 	struct param* ttl;       /* ttl parameter */
103
+	struct param* dstip;     /* Destination IP */
104
+	struct param* dstport;   /* Destination port */
101 105
 };
102 106
 
103 107