Ticket #4787: so_timestamping.1.53.0.2.patch

File so_timestamping.1.53.0.2.patch, 6.6 KB (added by jason@…, 9 years ago)

Improvement to previous patch for 1.53.0. These patches change the existing interfaces by adding additional parameters.

Line 
1Index: boost/asio/detail/reactive_socket_service.hpp
2===================================================================
3--- boost/asio/detail/reactive_socket_service.hpp 2014-11-02 00:00:00.000000000 -0600
4+++ boost/asio/detail/reactive_socket_service.hpp 2014-11-02 01:00:00.000000000 -0600
5267c267,269
6< flags, sender_endpoint.data(), &addr_len, ec);
7---
8> flags, sender_endpoint.data(), &addr_len,
9> sender_endpoint.control(), sender_endpoint.control_size(),
10> ec);
11Index: boost/asio/detail/socket_ops.hpp
12===================================================================
13--- boost/asio/detail/socket_ops.hpp 2014-11-02 00:00:00.000000000 -0600
14+++ boost/asio/detail/socket_ops.hpp 2014-11-02 01:00:00.000000000 -0600
15154c154,155
16< std::size_t* addrlen, boost::system::error_code& ec);
17---
18> std::size_t* addrlen, void* control, std::size_t controllen,
19> boost::system::error_code& ec);
20158c159,160
21< std::size_t* addrlen, boost::system::error_code& ec);
22---
23> std::size_t* addrlen, void* control, std::size_t controllen,
24> boost::system::error_code& ec);
25170a173
26> void* control, std::size_t controllen,
27Index: boost/asio/ip/detail/endpoint.hpp
28===================================================================
29--- boost/asio/ip/detail/endpoint.hpp 2014-11-02 00:00:00.000000000 -0600
30+++ boost/asio/ip/detail/endpoint.hpp 2014-11-02 01:00:00.000000000 -0600
3179a80,120
32> /// Get the underlying endpoint's first control header for recvfrom calls.
33> const struct cmsghdr* control_header_first() const
34> {
35> return CMSG_FIRSTHDR(control_.msg());
36> }
37>
38> /// Get the underlying endpoint's next control header for recvfrom calls.
39> const struct cmsghdr* control_header_next(const cmsghdr* prev) const
40> {
41> return static_cast<const struct cmsghdr*>(
42> CMSG_NXTHDR(const_cast<struct msghdr*>(control_.msg()),
43> const_cast<struct cmsghdr*>(prev)));
44> }
45>
46> /// Get the underlying size of the endpoint's buffer used to store
47> /// control messages.
48> template <typename T>
49> T control_msg_data(const struct cmsghdr* cmsg) const
50> {
51> return reinterpret_cast<T>(CMSG_DATA(cmsg));
52> }
53>
54> /// Get the underlying endpoint's control message given its header.
55> void* control_msg() const
56> {
57> return control_.msg()->msg_control;
58> }
59>
60> /// Get the underlying size of the endpoint's buffer used to store
61> /// control messages.
62> std::size_t control_size() const
63> {
64> return control_.msg()->msg_controllen;
65> }
66>
67> /// Set the size of the buffer used for storing control message.
68> void control_size(size_t size)
69> {
70> control_.allocate(size);
71> }
72>
73127a169,198
74>
75> // Space for control message for receive
76> struct control
77> {
78> control()
79> {
80> memset(&msg_, 0, sizeof(msghdr));
81> }
82> ~control()
83> {
84> allocate(0);
85> }
86> void allocate(size_t sz)
87> {
88> if (msg_.msg_control)
89> delete [] (char*)msg_.msg_control;
90> if (sz == 0)
91> return;
92> size_t n = sz > sizeof(struct cmsghdr) ? sz : sizeof(struct cmsghdr)+128;
93> msg_.msg_control = new char[n];
94> msg_.msg_controllen = n;
95> memset(msg_.msg_control, 0, n);
96> }
97>
98> const msghdr* msg() const { return &msg_; }
99> const cmsghdr* cmsg() const { return static_cast<const cmsghdr*>(msg_.msg_control); }
100> size_t cmsg_len() { return msg_.msg_controllen; }
101> private:
102> msghdr msg_;
103> } control_;
104Index: boost/asio/detail/win_iocp_socket_service.hpp
105===================================================================
106--- boost/asio/detail/win_iocp_socket_service.hpp 2014-11-02 00:00:00.000000000 -0600
107+++ boost/asio/detail/win_iocp_socket_service.hpp 2014-11-02 01:00:00.000000000 -0600
108347c347
109< flags, sender_endpoint.data(), &addr_len, ec);
110---
111> flags, sender_endpoint.data(), &addr_len, NULL, 0, ec);
112Index: boost/asio/ip/basic_endpoint.hpp
113===================================================================
114--- boost/asio/ip/basic_endpoint.hpp 2014-11-02 00:00:00.000000000 -0600
115+++ boost/asio/ip/basic_endpoint.hpp 2014-11-02 01:00:00.000000000 -0600
116156a157,195
117> /// Get the underlying endpoint's first control header for recvfrom calls.
118> const struct cmsghdr* control_header_first() const
119> {
120> return impl_.control_header_first();
121> }
122>
123> /// Get the underlying endpoint's next control header for recvfrom calls.
124> const struct cmsghdr* control_header_next(const cmsghdr* prev) const
125> {
126> return impl_.control_header_next(prev);
127> }
128>
129> /// Get the underlying size of the endpoint's buffer used to store
130> /// control messages.
131> template <typename T>
132> T control_msg_data(const struct cmsghdr* cmsg) const
133> {
134> return impl_.control_msg_data<T>(cmsg);
135> }
136>
137> /// Get the underlying endpoint's control message given its header.
138> void* control_msg() const
139> {
140> return impl_.control_msg();
141> }
142>
143> /// Get the underlying size of the endpoint's buffer used to store
144> /// control messages.
145> std::size_t control_size() const
146> {
147> return impl_.control_size();
148> }
149>
150> /// Set the size of the buffer used for storing control message.
151> void control_size(size_t size)
152> {
153> impl_.control_size(size);
154> }
155>
156Index: boost/asio/detail/impl/socket_ops.ipp
157===================================================================
158--- boost/asio/detail/impl/socket_ops.ipp 2014-11-02 00:00:00.000000000 -0600
159+++ boost/asio/detail/impl/socket_ops.ipp 2014-11-02 01:00:00.000000000 -0600
160819a820
161> void* control, std::size_t controllen,
162845a847,850
163> if (controllen > 0) {
164> msg.msg_control = control;
165> msg.msg_controllen = controllen;
166> }
167856c861,863
168< std::size_t* addrlen, boost::system::error_code& ec)
169---
170> std::size_t* addrlen,
171> void* control, std::size_t controllen,
172> boost::system::error_code& ec)
173869c876
174< s, bufs, count, flags, addr, addrlen, ec);
175---
176> s, bufs, count, flags, addr, addrlen, control, controllen, ec);
177911a919
178> void* control, std::size_t controllen,
179918c926
180< s, bufs, count, flags, addr, addrlen, ec);
181---
182> s, bufs, count, flags, addr, addrlen, control, controllen, ec);
183Index: boost/asio/detail/reactive_socket_recvfrom_op.hpp
184===================================================================
185--- boost/asio/detail/reactive_socket_recvfrom_op.hpp 2014-11-02 00:00:00.000000000 -0600
186+++ boost/asio/detail/reactive_socket_recvfrom_op.hpp 2014-11-02 01:00:00.000000000 -0600
18759a60
188> o->sender_endpoint_.control_msg(), o->sender_endpoint_.control_size(),