Lines Matching refs:offset

52 add_padding (uint8_t *extbuf, int offset, int npad)  in add_padding()  argument
55 extbuf[offset] = IP6OPT_PAD1; in add_padding()
58 struct ip6_opt *pad_opt = (struct ip6_opt *) (extbuf + offset); in add_padding()
79 inet6_opt_append (void *extbuf, socklen_t extlen, int offset, uint8_t type, in inet6_opt_append() argument
83 if (offset < sizeof (struct ip6_hbh)) in inet6_opt_append()
104 int data_offset = offset + sizeof (struct ip6_opt); in inet6_opt_append()
113 add_padding (extbuf, offset, npad); in inet6_opt_append()
115 offset += npad; in inet6_opt_append()
118 struct ip6_opt *opt = (struct ip6_opt *) ((uint8_t *) extbuf + offset); in inet6_opt_append()
126 offset += npad; in inet6_opt_append()
128 return offset + sizeof (struct ip6_opt) + len; in inet6_opt_append()
139 inet6_opt_finish (void *extbuf, socklen_t extlen, int offset) in inet6_opt_finish() argument
142 if (offset < sizeof (struct ip6_hbh)) in inet6_opt_finish()
146 int npad = (8 - (offset & 7)) & 7; in inet6_opt_finish()
151 if (offset + npad > extlen) in inet6_opt_finish()
154 add_padding (extbuf, offset, npad); in inet6_opt_finish()
157 return offset + npad; in inet6_opt_finish()
169 inet6_opt_set_val (void *databuf, int offset, void *val, socklen_t vallen) in inet6_opt_set_val() argument
171 memcpy ((uint8_t *) databuf + offset, val, vallen); in inet6_opt_set_val()
173 return offset + vallen; in inet6_opt_set_val()
186 inet6_opt_next (void *extbuf, socklen_t extlen, int offset, uint8_t *typep, in inet6_opt_next() argument
189 if (offset == 0) in inet6_opt_next()
190 offset = sizeof (struct ip6_hbh); in inet6_opt_next()
191 else if (offset < sizeof (struct ip6_hbh)) in inet6_opt_next()
194 while (offset < extlen) in inet6_opt_next()
196 struct ip6_opt *opt = (struct ip6_opt *) ((uint8_t *) extbuf + offset); in inet6_opt_next()
200 ++offset; in inet6_opt_next()
202 offset += sizeof (struct ip6_opt) + opt->ip6o_len; in inet6_opt_next()
206 offset += sizeof (struct ip6_opt) + opt->ip6o_len; in inet6_opt_next()
207 if (offset > extlen) in inet6_opt_next()
213 return offset; in inet6_opt_next()
228 inet6_opt_find (void *extbuf, socklen_t extlen, int offset, uint8_t type, in inet6_opt_find() argument
231 if (offset == 0) in inet6_opt_find()
232 offset = sizeof (struct ip6_hbh); in inet6_opt_find()
233 else if (offset < sizeof (struct ip6_hbh)) in inet6_opt_find()
236 while (offset < extlen) in inet6_opt_find()
238 struct ip6_opt *opt = (struct ip6_opt *) ((uint8_t *) extbuf + offset); in inet6_opt_find()
243 ++offset; in inet6_opt_find()
247 *databufp = (uint8_t *) extbuf + offset; in inet6_opt_find()
248 return offset; in inet6_opt_find()
252 offset += sizeof (struct ip6_opt) + opt->ip6o_len; in inet6_opt_find()
256 offset += sizeof (struct ip6_opt) + opt->ip6o_len; in inet6_opt_find()
257 if (offset > extlen) in inet6_opt_find()
262 return offset; in inet6_opt_find()
275 inet6_opt_get_val (void *databuf, int offset, void *val, socklen_t vallen) in inet6_opt_get_val() argument
277 memcpy (val, (uint8_t *) databuf + offset, vallen); in inet6_opt_get_val()
279 return offset + vallen; in inet6_opt_get_val()