Lines Matching refs:contexts

80 static struct net_context contexts[NET_MAX_CONTEXT];  variable
169 if (!net_context_is_used(&contexts[i])) { in check_used_port()
173 if (!(net_context_get_proto(&contexts[i]) == proto && in check_used_port()
175 contexts[i].local)->sin_port == local_port)) { in check_used_port()
179 if (net_context_is_bound_to_iface(&contexts[i])) { in check_used_port()
180 if (iface != NULL && iface != net_context_get_iface(&contexts[i])) { in check_used_port()
187 if (net_sin6_ptr(&contexts[i].local)->sin6_addr == NULL || in check_used_port()
188 net_sin6_ptr(&contexts[i].local)->sin6_family != AF_INET6) { in check_used_port()
193 net_sin6_ptr(&contexts[i].local)->sin6_addr) || in check_used_port()
197 net_context_is_reuseport_set(&contexts[i])) { in check_used_port()
203 !is_in_tcp_listen_state(&contexts[i]) && in check_used_port()
205 net_sin6_ptr(&contexts[i].local)->sin6_addr) && in check_used_port()
221 net_sin6_ptr(&contexts[i].local)-> in check_used_port()
226 net_context_is_reuseport_set(&contexts[i])) { in check_used_port()
232 is_in_tcp_time_wait_state(&contexts[i])) { in check_used_port()
247 if (net_sin_ptr(&contexts[i].local)->sin_addr == NULL || in check_used_port()
249 net_context_is_v6only_set(&contexts[i]) : true) && in check_used_port()
250 net_sin_ptr(&contexts[i].local)->sin_family != AF_INET)) { in check_used_port()
255 net_sin_ptr(&contexts[i].local)->sin_addr) || in check_used_port()
259 net_context_is_reuseport_set(&contexts[i])) { in check_used_port()
265 !is_in_tcp_listen_state(&contexts[i]) && in check_used_port()
267 net_sin_ptr(&contexts[i].local)->sin_addr) && in check_used_port()
283 net_sin_ptr(&contexts[i].local)-> in check_used_port()
288 net_context_is_reuseport_set(&contexts[i])) { in check_used_port()
294 is_in_tcp_time_wait_state(&contexts[i])) { in check_used_port()
448 if (net_context_is_used(&contexts[i])) { in net_context_get()
452 memset(&contexts[i], 0, sizeof(contexts[i])); in net_context_get()
458 if (net_tcp_get(&contexts[i]) < 0) { in net_context_get()
463 contexts[i].iface = -1; in net_context_get()
464 contexts[i].flags = 0U; in net_context_get()
465 atomic_set(&contexts[i].refcount, 1); in net_context_get()
467 net_context_set_family(&contexts[i], family); in net_context_get()
468 net_context_set_type(&contexts[i], type); in net_context_get()
469 net_context_set_proto(&contexts[i], proto); in net_context_get()
472 contexts[i].options.rcvtimeo = K_FOREVER; in net_context_get()
475 contexts[i].options.sndtimeo = K_FOREVER; in net_context_get()
479 contexts[i].options.ipv6_v6only = true; in net_context_get()
482 (void)memset(&contexts[i].remote, 0, sizeof(struct sockaddr)); in net_context_get()
483 (void)memset(&contexts[i].local, 0, sizeof(struct sockaddr_ptr)); in net_context_get()
487 (struct sockaddr_in6 *)&contexts[i].local; in net_context_get()
489 find_available_port(&contexts[i], (struct sockaddr *)addr6); in net_context_get()
496 contexts[i].ipv6_hop_limit = INITIAL_HOP_LIMIT; in net_context_get()
497 contexts[i].ipv6_mcast_hop_limit = INITIAL_MCAST_HOP_LIMIT; in net_context_get()
500 struct sockaddr_in *addr = (struct sockaddr_in *)&contexts[i].local; in net_context_get()
503 find_available_port(&contexts[i], (struct sockaddr *)addr); in net_context_get()
510 contexts[i].ipv4_ttl = INITIAL_TTL; in net_context_get()
511 contexts[i].ipv4_mcast_ttl = INITIAL_MCAST_TTL; in net_context_get()
516 k_sem_init(&contexts[i].recv_data_wait, 1, K_SEM_MAX_LIMIT); in net_context_get()
519 k_mutex_init(&contexts[i].lock); in net_context_get()
521 contexts[i].flags |= NET_CONTEXT_IN_USE; in net_context_get()
522 *context = &contexts[i]; in net_context_get()
595 if (!PART_OF_ARRAY(contexts, context)) { in net_context_put()
716 NET_ASSERT(PART_OF_ARRAY(contexts, context)); in net_context_bind()
1043 if (!net_context_is_used(&contexts[i])) { in find_context()
1047 if (contexts[i].conn_handler == conn_handler) { in find_context()
1048 return &contexts[i]; in find_context()
1059 NET_ASSERT(PART_OF_ARRAY(contexts, context)); in net_context_listen()
1167 NET_ASSERT(PART_OF_ARRAY(contexts, context)); in net_context_connect()
1343 NET_ASSERT(PART_OF_ARRAY(contexts, context)); in net_context_accept()
1887 NET_ASSERT(PART_OF_ARRAY(contexts, context)); in context_sendto()
2984 if (!PART_OF_ARRAY(contexts, context)) { in net_context_set_option()
3054 if (!PART_OF_ARRAY(contexts, context)) { in net_context_get_option()
3123 if (!net_context_is_used(&contexts[i])) { in net_context_foreach()
3127 k_mutex_lock(&contexts[i].lock, K_FOREVER); in net_context_foreach()
3129 cb(&contexts[i], user_data); in net_context_foreach()
3131 k_mutex_unlock(&contexts[i].lock); in net_context_foreach()