1 /* dnsmasq is Copyright (c) 2000-2013 Simon Kelley
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 dated June, 1991, or
6 (at your option) version 3 dated 29 June, 2007.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 static size_t outpacket_counter
;
24 void end_opt6(int container
)
26 void *p
= daemon
->outpacket
.iov_base
+ container
+ 2;
27 u16 len
= outpacket_counter
- container
- 4 ;
32 int save_counter(int newval
)
34 int ret
= outpacket_counter
;
36 outpacket_counter
= newval
;
41 void *expand(size_t headroom
)
45 if (expand_buf(&daemon
->outpacket
, outpacket_counter
+ headroom
))
47 ret
= daemon
->outpacket
.iov_base
+ outpacket_counter
;
48 outpacket_counter
+= headroom
;
57 int ret
= outpacket_counter
;
69 void *put_opt6(void *data
, size_t len
)
73 if ((p
= expand(len
)) && data
)
79 void put_opt6_long(unsigned int val
)
87 void put_opt6_short(unsigned int val
)
95 void put_opt6_char(unsigned int val
)
103 void put_opt6_string(char *s
)
105 put_opt6(s
, strlen(s
));