Home | History | Annotate | Download | only in ServiceRegistration

Lines Matching defs:io_context

54 typedef struct io_context io_context_t;
56 struct io_context {
90 io_context_t *io_context;
91 if (validate_io_context(&io_context, context) == kDNSServiceErr_NoError) {
102 io_context->datagram_callback(io_context->srp_context, buf, length);
125 io_context_t *io_context;
129 for (io_context = io_contexts; io_context; io_context = io_context->next) {
130 if (next == 0 || (io_context->wakeup_time != 0 && io_context->wakeup_time < next)) {
131 next = io_context->wakeup_time;
157 io_context_t *io_context;
164 for (io_context = io_contexts; io_context; io_context = io_context->next) {
165 if (io_context->wakeup_time != 0 && io_context->wakeup_time < now) {
167 note_wakeup("io wakeup", io_context, io_context->wakeup_time);
168 io_context->wakeup_time = 0;
169 io_context->wakeup_callback(io_context->srp_context);
172 note_wakeup("no wakeup", io_context, io_context->wakeup_time);
173 if (next == 0 || (io_context->wakeup_time != 0 && io_context->wakeup_time < next))
175 next = io_context->wakeup_time;
185 io_context_t *io_context, **p_io_contexts;
188 err = validate_io_context(&io_context, in_context);
191 if (*p_io_contexts == io_context) {
199 *p_io_contexts = io_context->next;
200 io_context->wakeup_time = 0;
201 if (io_context->sock_active) {
202 otUdpClose(&io_context->sock);
204 free(io_context);
212 io_context_t *io_context;
215 err = validate_io_context(&io_context, context);
222 memcpy(&io_context->sockaddr.mAddress, address, 16);
223 memcpy(&io_context->sockaddr.mPort, port, 2);
225 io_context->sockaddr.mScopeId = OT_NETIF_INTERFACE_ID_THREAD;
228 oterr = otUdpOpen(otThreadInstance, &io_context->sock, datagram_callback, io_context);
234 oterr = otUdpConnect(&io_context->sock, &io_context->sockaddr);
236 otUdpClose(&io_context->sock);
240 io_context->sock_active = true;
249 io_context_t *io_context;
252 err = validate_io_context(&io_context, context);
253 if (err == kDNSServiceErr_NoError && io_context->sock_active) {
254 otUdpClose(&io_context->sock);
255 io_context->sock_active = false;
263 io_context_t *io_context = calloc(1, sizeof *io_context);
264 if (io_context == NULL) {
268 io_context->magic_cookie1 = io_context->magic_cookie2 = SRP_IO_CONTEXT_MAGIC;
269 io_context->datagram_callback = callback;
270 io_context->srp_context = context;
272 *p_context = io_context;
273 io_context->next = io_contexts;
274 io_contexts = io_context;
282 io_context_t *io_context;
285 err = validate_io_context(&io_context, context);
288 io_context->wakeup_time = now + milliseconds * (HAPTIME_FREQUENCY / 1000);
289 io_context->wakeup_callback = callback;
290 INFO("%llu (%llu + %dms)", io_context->wakeup_time, now, milliseconds);
300 io_context_t *io_context;
302 err = validate_io_context(&io_context, context);
304 io_context->wakeup_time = 0;
313 io_context_t *io_context;
326 err = validate_io_context(&io_context, context);
332 messageInfo.mPeerPort = io_context->sockaddr.mPort;
333 messageInfo.mPeerAddr = io_context->sockaddr.mAddress;
334 ap = (uint8_t *)&io_context->sockaddr.mAddress;
337 io_context->sockaddr.mPort);
367 error = otUdpSend(&io_context->sock, message, &messageInfo);