• Home
  • Raw
  • Download

Lines Matching refs:vh

293 lws_vhost_protocol_options(struct lws_vhost *vh, const char *name)  in lws_vhost_protocol_options()  argument
295 const struct lws_protocol_vhost_options *pvo = vh->pvo; in lws_vhost_protocol_options()
310 lws_protocol_init_vhost(struct lws_vhost *vh, int *any) in lws_protocol_init_vhost() argument
313 struct lws *wsi = vh->context->pt[0].fake_wsi; in lws_protocol_init_vhost()
316 wsi->context = vh->context; in lws_protocol_init_vhost()
317 wsi->vhost = vh; in lws_protocol_init_vhost()
321 for (n = 0; n < vh->count_protocols; n++) { in lws_protocol_init_vhost()
322 wsi->protocol = &vh->protocols[n]; in lws_protocol_init_vhost()
323 if (!vh->protocols[n].name) in lws_protocol_init_vhost()
325 pvo = lws_vhost_protocol_options(vh, vh->protocols[n].name); in lws_protocol_init_vhost()
339 vh->name, in lws_protocol_init_vhost()
340 vh->protocols[n].name, in lws_protocol_init_vhost()
346 vh->name, in lws_protocol_init_vhost()
347 vh->protocols[n].name); in lws_protocol_init_vhost()
348 vh->default_protocol_index = n; in lws_protocol_init_vhost()
353 vh->name, in lws_protocol_init_vhost()
354 vh->protocols[n].name); in lws_protocol_init_vhost()
355 vh->raw_protocol_index = n; in lws_protocol_init_vhost()
365 *any |= !!vh->tls.ssl_ctx; in lws_protocol_init_vhost()
375 if (vh->protocols[n].callback(wsi, in lws_protocol_init_vhost()
378 if (vh->protocol_vh_privs[n]) { in lws_protocol_init_vhost()
379 lws_free(vh->protocol_vh_privs[n]); in lws_protocol_init_vhost()
380 vh->protocol_vh_privs[n] = NULL; in lws_protocol_init_vhost()
383 __func__, vh->protocols[n].name); in lws_protocol_init_vhost()
389 vh->created_vhost_protocols = 1; in lws_protocol_init_vhost()
401 struct lws_vhost *vh = context->vhost_list; in lws_protocol_init() local
411 while (vh) { in lws_protocol_init()
414 if (vh->created_vhost_protocols || in lws_protocol_init()
415 (lws_check_opt(vh->options, LWS_SERVER_OPTION_SKIP_PROTOCOL_INIT))) in lws_protocol_init()
418 if (lws_protocol_init_vhost(vh, &any)) in lws_protocol_init()
421 vh = vh->vhost_next; in lws_protocol_init()
469 struct lws_vhost *vh = lws_zalloc(sizeof(*vh), "create vhost"), in lws_create_vhost() local
488 if (!vh) in lws_create_vhost()
492 pthread_mutex_init(&vh->lock, NULL); in lws_create_vhost()
498 vh->context = context; in lws_create_vhost()
500 vh->name = "default"; in lws_create_vhost()
502 vh->name = info->vhost_name; in lws_create_vhost()
505 vh->http.error_document_404 = info->error_document_404; in lws_create_vhost()
509 lwsl_info("%s set to only support RAW\n", vh->name); in lws_create_vhost()
511 vh->iface = info->iface; in lws_create_vhost()
513 vh->bind_iface = info->bind_iface; in lws_create_vhost()
518 vh->retry_policy = info->retry_and_idle_policy; in lws_create_vhost()
520 vh->retry_policy = &context->default_retry; in lws_create_vhost()
528 for (vh->count_protocols = 0; in lws_create_vhost()
529 info->pprotocols[vh->count_protocols]; in lws_create_vhost()
530 vh->count_protocols++) in lws_create_vhost()
533 for (vh->count_protocols = 0; in lws_create_vhost()
534 pcols[vh->count_protocols].callback; in lws_create_vhost()
535 vh->count_protocols++) in lws_create_vhost()
538 vh->options = info->options; in lws_create_vhost()
539 vh->pvo = info->pvo; in lws_create_vhost()
540 vh->headers = info->headers; in lws_create_vhost()
541 vh->user = info->user; in lws_create_vhost()
542 vh->finalize = info->finalize; in lws_create_vhost()
543 vh->finalize_arg = info->finalize_arg; in lws_create_vhost()
544 vh->listen_accept_role = info->listen_accept_role; in lws_create_vhost()
545 vh->listen_accept_protocol = info->listen_accept_protocol; in lws_create_vhost()
546 vh->unix_socket_perms = info->unix_socket_perms; in lws_create_vhost()
550 if (ar->init_vhost(vh, info)) in lws_create_vhost()
556 vh->keepalive_timeout = info->keepalive_timeout; in lws_create_vhost()
558 vh->keepalive_timeout = 5; in lws_create_vhost()
561 vh->timeout_secs_ah_idle = info->timeout_secs_ah_idle; in lws_create_vhost()
563 vh->timeout_secs_ah_idle = 10; in lws_create_vhost()
567 vh->tls.alpn = info->alpn; in lws_create_vhost()
568 vh->tls.ssl_info_event_mask = info->ssl_info_event_mask; in lws_create_vhost()
571 lws_strncpy(vh->tls.ecdh_curve, info->ecdh_curve, in lws_create_vhost()
572 sizeof(vh->tls.ecdh_curve)); in lws_create_vhost()
582 vh->tls.key_path = vh->tls.alloc_cert_path = in lws_create_vhost()
586 memcpy(vh->tls.alloc_cert_path, in lws_create_vhost()
588 vh->tls.key_path += n; in lws_create_vhost()
591 memcpy(vh->tls.key_path, info->ssl_private_key_filepath, in lws_create_vhost()
615 (vh->count_protocols + in lws_create_vhost()
629 m = vh->count_protocols; in lws_create_vhost()
643 vh->count_protocols++; in lws_create_vhost()
653 vh->count_protocols++; in lws_create_vhost()
661 vh->count_protocols++; in lws_create_vhost()
682 if (f || lws_vhost_protocol_options(vh, in lws_create_vhost()
688 vh->count_protocols++; in lws_create_vhost()
698 vh->count_protocols++; in lws_create_vhost()
701 vh->protocols = lwsp; in lws_create_vhost()
702 vh->allocated_vhost_protocols = 1; in lws_create_vhost()
704 vh->same_vh_protocol_owner = (struct lws_dll2_owner *) in lws_create_vhost()
706 vh->count_protocols, "same vh list"); in lws_create_vhost()
708 vh->http.mount_list = info->mounts; in lws_create_vhost()
712 if (LWS_UNIX_SOCK_ENABLED(vh)) { in lws_create_vhost()
714 vh->name, vh->iface, vh->count_protocols); in lws_create_vhost()
730 vh->name, buf, vh->count_protocols, in lws_create_vhost()
731 LWS_IPV6_ENABLED(vh) ? "on" : "off"); in lws_create_vhost()
743 vh->listen_port = info->port; in lws_create_vhost()
746 vh->socks_proxy_port = 0; in lws_create_vhost()
747 vh->socks_proxy_address[0] = '\0'; in lws_create_vhost()
753 vh->http.http_proxy_port = 0; in lws_create_vhost()
754 vh->http.http_proxy_address[0] = '\0'; in lws_create_vhost()
759 vh->http.http_proxy_port = info->http_proxy_port; in lws_create_vhost()
760 lws_set_proxy(vh, info->http_proxy_address); in lws_create_vhost()
771 lws_set_proxy(vh, buf); in lws_create_vhost()
778 lws_socks5c_ads_server(vh, info); in lws_create_vhost()
781 vh->ka_time = info->ka_time; in lws_create_vhost()
782 vh->ka_interval = info->ka_interval; in lws_create_vhost()
783 vh->ka_probes = info->ka_probes; in lws_create_vhost()
785 if (vh->options & LWS_SERVER_OPTION_STS) in lws_create_vhost()
790 vh->log_fd = lws_open(info->log_filepath, in lws_create_vhost()
792 if (vh->log_fd == (int)LWS_INVALID_FILE) { in lws_create_vhost()
805 vh->log_fd = (int)LWS_INVALID_FILE; in lws_create_vhost()
807 if (lws_context_init_server_ssl(info, vh)) { in lws_create_vhost()
811 if (lws_context_init_client_ssl(info, vh)) { in lws_create_vhost()
817 n = _lws_vhost_init_server(info, vh); in lws_create_vhost()
828 *vh1 = vh; in lws_create_vhost()
847 return vh; in lws_create_vhost()
850 lws_vhost_destroy(vh); in lws_create_vhost()
856 lws_free(vh); in lws_create_vhost()
982 lws_vhost_destroy1(struct lws_vhost *vh) argument
984 struct lws_context *context = vh->context;
990 if (vh->being_destroyed)
993 lws_vhost_lock(vh); /* -------------- vh { */
1008 if (vh->lserv_wsi)
1011 if (v != vh &&
1013 v->listen_port == vh->listen_port &&
1014 ((!v->iface && !vh->iface) ||
1015 (v->iface && vh->iface &&
1016 !strcmp(v->iface, vh->iface)))) {
1025 v->lserv_wsi = vh->lserv_wsi;
1028 __func__, vh->name, v->name);
1031 lws_vhost_unbind_wsi(vh->lserv_wsi);
1041 lws_vhost_unlock(vh); /* } vh -------------- */
1068 __lws_vhost_destroy2(struct lws_vhost *vh) argument
1071 struct lws_context *context = vh->context;
1076 vh->being_destroyed = 0;
1084 vh->vh_awaiting_socket_owner.head) {
1098 while (vh->timed_vh_protocol_list)
1099 __lws_timed_callback_remove(vh, vh->timed_vh_protocol_list);
1106 wsi.context = vh->context;
1107 wsi.vhost = vh; /* not a real bound wsi */
1108 protocol = vh->protocols;
1109 if (protocol && vh->created_vhost_protocols) {
1111 while (n < vh->count_protocols) {
1127 if (*pv == vh) {
1128 *pv = vh->vhost_next;
1135 vh->vhost_next = vh->context->vhost_pending_destruction_list;
1136 vh->context->vhost_pending_destruction_list = vh;
1138 lwsl_info("%s: %p\n", __func__, vh);
1144 if ((*pdf)->payload == vh) {
1156 if ((*pv) == vh) {
1166 protocol = vh->protocols;
1169 while (n < vh->count_protocols) {
1170 if (vh->protocol_vh_privs &&
1171 vh->protocol_vh_privs[n]) {
1172 lws_free(vh->protocol_vh_privs[n]);
1173 vh->protocol_vh_privs[n] = NULL;
1179 if (vh->protocol_vh_privs)
1180 lws_free(vh->protocol_vh_privs);
1181 lws_ssl_SSL_CTX_destroy(vh);
1182 lws_free(vh->same_vh_protocol_owner);
1189 vh->allocated_vhost_protocols)
1190 lws_free((void *)vh->protocols);
1194 ar->destroy_vhost(vh);
1199 if (vh->log_fd != (int)LWS_INVALID_FILE)
1200 close(vh->log_fd);
1204 lws_free_set_NULL(vh->tls.alloc_cert_path);
1208 pthread_mutex_destroy(&vh->lock);
1212 if (LWS_UNIX_SOCK_ENABLED(vh)) {
1213 n = unlink(vh->iface);
1216 vh->iface, errno);
1225 if (vh->finalize)
1226 vh->finalize(vh, vh->finalize_arg);
1233 lws_dll2_foreach_safe(&vh->abstract_instances_owner, NULL, destroy_ais);
1236 lwsl_info(" %s: Freeing vhost %p\n", __func__, vh);
1238 memset(vh, 0, sizeof(*vh));
1239 lws_free(vh);
1307 lws_vhost_destroy(struct lws_vhost *vh) argument
1310 struct lws_context *context = vh->context;
1317 lws_vhost_destroy1(vh);
1319 lwsl_debug("%s: count_bound_wsi %d\n", __func__, vh->count_bound_wsi);
1321 if (!vh->count_bound_wsi) {
1329 __lws_vhost_destroy2(vh);
1337 df->next = vh->context->deferred_free_list;
1339 df->payload = vh;
1340 vh->context->deferred_free_list = df;
1363 struct lws_vhost *vh = context->vhost_list, *vh1; local
1376 while (vh) {
1377 struct lws *wsi = vh->lserv_wsi;
1394 vh = vh->vhost_next;