-#include "md_stdlib.h"\r
-#include "gsconfig.h"\r
-#include "gstypes.h"\r
-#include "rts_external.h"\r
-\r
-/* ------------------------------------------------\r
-Copyright 2014 AT&T Intellectual Property\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
- ------------------------------------------- */\r
-\r
-\r
-gs_retval_t has_ipv4_option( struct gs_string * s, gs_uint32_t ipoption) {\r
- gs_int32_t x=0;\r
- gs_int32_t on;\r
- gs_int32_t len;\r
-\r
- if (s->length==0) return 0; /* no match */\r
-\r
- while(0==0) {\r
- if ((on=s->data[x]&0x1f)==ipoption) return 1; /* got a match */\r
- switch (on) {\r
- case 0:\r
- return 0; /* no match and end of list */\r
- case 1:\r
- x++; /* one byte options */\r
- break;\r
- case 2: /* 11 byte security option */\r
- x+=11;\r
- break;\r
- case 8:\r
- x+=4; /* stream id option */\r
- break;\r
- case 3:\r
- case 9:\r
- case 7:\r
- case 4:\r
- if (x+1>=s->length) return 0; /* run out of data no match */\r
- len=s->data[x+1];\r
- x+=len;\r
- break;\r
- default:\r
- return 0; /* don't undestand the option */\r
- }\r
- if (x>=s->length) return 0; /* run out of data no match */\r
- }\r
- \r
- return 0; /* should never be reached */\r
-}\r
+#include "md_stdlib.h"
+#include "gsconfig.h"
+#include "gstypes.h"
+#include "rts_external.h"
+
+/* ------------------------------------------------
+Copyright 2014 AT&T Intellectual Property
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ------------------------------------------- */
+
+
+gs_retval_t has_ipv4_option( struct gs_string * s, gs_uint32_t ipoption) {
+ gs_int32_t x=0;
+ gs_int32_t on;
+ gs_int32_t len;
+
+ if (s->length==0) return 0; /* no match */
+
+ while(0==0) {
+ if ((on=s->data[x]&0x1f)==ipoption) return 1; /* got a match */
+ switch (on) {
+ case 0:
+ return 0; /* no match and end of list */
+ case 1:
+ x++; /* one byte options */
+ break;
+ case 2: /* 11 byte security option */
+ x+=11;
+ break;
+ case 8:
+ x+=4; /* stream id option */
+ break;
+ case 3:
+ case 9:
+ case 7:
+ case 4:
+ if (x+1>=s->length) return 0; /* run out of data no match */
+ len=s->data[x+1];
+ x+=len;
+ break;
+ default:
+ return 0; /* don't undestand the option */
+ }
+ if (x>=s->length) return 0; /* run out of data no match */
+ }
+
+ return 0; /* should never be reached */
+}