xref: /unit/src/python/nxt_python_asgi_str.c (revision 2483:9d1e9b09cc6f)
11624Smax.romanov@nginx.com 
21624Smax.romanov@nginx.com /*
31624Smax.romanov@nginx.com  * Copyright (C) NGINX, Inc.
41624Smax.romanov@nginx.com  */
51624Smax.romanov@nginx.com 
61624Smax.romanov@nginx.com 
71624Smax.romanov@nginx.com #include <python/nxt_python.h>
81624Smax.romanov@nginx.com 
91624Smax.romanov@nginx.com #if (NXT_HAVE_ASGI)
101624Smax.romanov@nginx.com 
111624Smax.romanov@nginx.com #include <nxt_main.h>
121624Smax.romanov@nginx.com #include <python/nxt_python_asgi_str.h>
131624Smax.romanov@nginx.com 
141624Smax.romanov@nginx.com 
151624Smax.romanov@nginx.com PyObject  *nxt_py_1_0_str;
161624Smax.romanov@nginx.com PyObject  *nxt_py_1_1_str;
171624Smax.romanov@nginx.com PyObject  *nxt_py_2_0_str;
181624Smax.romanov@nginx.com PyObject  *nxt_py_2_1_str;
191624Smax.romanov@nginx.com PyObject  *nxt_py_3_0_str;
201624Smax.romanov@nginx.com PyObject  *nxt_py_add_done_callback_str;
211624Smax.romanov@nginx.com PyObject  *nxt_py_asgi_str;
221624Smax.romanov@nginx.com PyObject  *nxt_py_bad_state_str;
231624Smax.romanov@nginx.com PyObject  *nxt_py_body_str;
241624Smax.romanov@nginx.com PyObject  *nxt_py_bytes_str;
251624Smax.romanov@nginx.com PyObject  *nxt_py_client_str;
261624Smax.romanov@nginx.com PyObject  *nxt_py_code_str;
271624Smax.romanov@nginx.com PyObject  *nxt_py_done_str;
281624Smax.romanov@nginx.com PyObject  *nxt_py_exception_str;
291624Smax.romanov@nginx.com PyObject  *nxt_py_failed_to_send_body_str;
301624Smax.romanov@nginx.com PyObject  *nxt_py_headers_str;
311624Smax.romanov@nginx.com PyObject  *nxt_py_http_str;
321624Smax.romanov@nginx.com PyObject  *nxt_py_http_disconnect_str;
331624Smax.romanov@nginx.com PyObject  *nxt_py_http_request_str;
341624Smax.romanov@nginx.com PyObject  *nxt_py_http_version_str;
351624Smax.romanov@nginx.com PyObject  *nxt_py_https_str;
361624Smax.romanov@nginx.com PyObject  *nxt_py_lifespan_str;
371624Smax.romanov@nginx.com PyObject  *nxt_py_lifespan_shutdown_str;
381624Smax.romanov@nginx.com PyObject  *nxt_py_lifespan_startup_str;
391624Smax.romanov@nginx.com PyObject  *nxt_py_method_str;
401624Smax.romanov@nginx.com PyObject  *nxt_py_message_str;
411624Smax.romanov@nginx.com PyObject  *nxt_py_message_too_big_str;
421624Smax.romanov@nginx.com PyObject  *nxt_py_more_body_str;
431624Smax.romanov@nginx.com PyObject  *nxt_py_path_str;
441624Smax.romanov@nginx.com PyObject  *nxt_py_query_string_str;
451624Smax.romanov@nginx.com PyObject  *nxt_py_raw_path_str;
461624Smax.romanov@nginx.com PyObject  *nxt_py_result_str;
471624Smax.romanov@nginx.com PyObject  *nxt_py_root_path_str;
481624Smax.romanov@nginx.com PyObject  *nxt_py_scheme_str;
491624Smax.romanov@nginx.com PyObject  *nxt_py_server_str;
501624Smax.romanov@nginx.com PyObject  *nxt_py_set_exception_str;
511624Smax.romanov@nginx.com PyObject  *nxt_py_set_result_str;
521624Smax.romanov@nginx.com PyObject  *nxt_py_spec_version_str;
531624Smax.romanov@nginx.com PyObject  *nxt_py_status_str;
541624Smax.romanov@nginx.com PyObject  *nxt_py_subprotocol_str;
551624Smax.romanov@nginx.com PyObject  *nxt_py_subprotocols_str;
561624Smax.romanov@nginx.com PyObject  *nxt_py_text_str;
571624Smax.romanov@nginx.com PyObject  *nxt_py_type_str;
58*2483Sdiguohuangjiajinweijun@gmail.com PyObject  *nxt_py_state_str;
591624Smax.romanov@nginx.com PyObject  *nxt_py_version_str;
601624Smax.romanov@nginx.com PyObject  *nxt_py_websocket_str;
611624Smax.romanov@nginx.com PyObject  *nxt_py_websocket_accept_str;
621624Smax.romanov@nginx.com PyObject  *nxt_py_websocket_close_str;
631624Smax.romanov@nginx.com PyObject  *nxt_py_websocket_connect_str;
641624Smax.romanov@nginx.com PyObject  *nxt_py_websocket_disconnect_str;
651624Smax.romanov@nginx.com PyObject  *nxt_py_websocket_receive_str;
661624Smax.romanov@nginx.com PyObject  *nxt_py_websocket_send_str;
671624Smax.romanov@nginx.com PyObject  *nxt_py_ws_str;
681624Smax.romanov@nginx.com PyObject  *nxt_py_wss_str;
691624Smax.romanov@nginx.com 
701624Smax.romanov@nginx.com static nxt_python_string_t nxt_py_asgi_strings[] = {
711624Smax.romanov@nginx.com     { nxt_string("1.0"), &nxt_py_1_0_str },
721624Smax.romanov@nginx.com     { nxt_string("1.1"), &nxt_py_1_1_str },
731624Smax.romanov@nginx.com     { nxt_string("2.0"), &nxt_py_2_0_str },
741624Smax.romanov@nginx.com     { nxt_string("2.1"), &nxt_py_2_1_str },
751624Smax.romanov@nginx.com     { nxt_string("3.0"), &nxt_py_3_0_str },
761624Smax.romanov@nginx.com     { nxt_string("add_done_callback"), &nxt_py_add_done_callback_str },
771624Smax.romanov@nginx.com     { nxt_string("asgi"), &nxt_py_asgi_str },
781624Smax.romanov@nginx.com     { nxt_string("bad state"), &nxt_py_bad_state_str },
791624Smax.romanov@nginx.com     { nxt_string("body"), &nxt_py_body_str },
801624Smax.romanov@nginx.com     { nxt_string("bytes"), &nxt_py_bytes_str },
811624Smax.romanov@nginx.com     { nxt_string("client"), &nxt_py_client_str },
821624Smax.romanov@nginx.com     { nxt_string("code"), &nxt_py_code_str },
831624Smax.romanov@nginx.com     { nxt_string("done"), &nxt_py_done_str },
841624Smax.romanov@nginx.com     { nxt_string("exception"), &nxt_py_exception_str },
851624Smax.romanov@nginx.com     { nxt_string("failed to send body"), &nxt_py_failed_to_send_body_str },
861624Smax.romanov@nginx.com     { nxt_string("headers"), &nxt_py_headers_str },
871624Smax.romanov@nginx.com     { nxt_string("http"), &nxt_py_http_str },
881624Smax.romanov@nginx.com     { nxt_string("http.disconnect"), &nxt_py_http_disconnect_str },
891624Smax.romanov@nginx.com     { nxt_string("http.request"), &nxt_py_http_request_str },
901624Smax.romanov@nginx.com     { nxt_string("http_version"), &nxt_py_http_version_str },
911624Smax.romanov@nginx.com     { nxt_string("https"), &nxt_py_https_str },
921624Smax.romanov@nginx.com     { nxt_string("lifespan"), &nxt_py_lifespan_str },
931624Smax.romanov@nginx.com     { nxt_string("lifespan.shutdown"), &nxt_py_lifespan_shutdown_str },
941624Smax.romanov@nginx.com     { nxt_string("lifespan.startup"), &nxt_py_lifespan_startup_str },
951624Smax.romanov@nginx.com     { nxt_string("message"), &nxt_py_message_str },
961624Smax.romanov@nginx.com     { nxt_string("message too big"), &nxt_py_message_too_big_str },
971624Smax.romanov@nginx.com     { nxt_string("method"), &nxt_py_method_str },
981624Smax.romanov@nginx.com     { nxt_string("more_body"), &nxt_py_more_body_str },
991624Smax.romanov@nginx.com     { nxt_string("path"), &nxt_py_path_str },
1001624Smax.romanov@nginx.com     { nxt_string("query_string"), &nxt_py_query_string_str },
1011624Smax.romanov@nginx.com     { nxt_string("raw_path"), &nxt_py_raw_path_str },
1021624Smax.romanov@nginx.com     { nxt_string("result"), &nxt_py_result_str },
1032273Sjeff.iadarola@gmail.com     { nxt_string("root_path"), &nxt_py_root_path_str },
1041624Smax.romanov@nginx.com     { nxt_string("scheme"), &nxt_py_scheme_str },
1051624Smax.romanov@nginx.com     { nxt_string("server"), &nxt_py_server_str },
1061624Smax.romanov@nginx.com     { nxt_string("set_exception"), &nxt_py_set_exception_str },
1071624Smax.romanov@nginx.com     { nxt_string("set_result"), &nxt_py_set_result_str },
1081624Smax.romanov@nginx.com     { nxt_string("spec_version"), &nxt_py_spec_version_str },
1091624Smax.romanov@nginx.com     { nxt_string("status"), &nxt_py_status_str },
1101624Smax.romanov@nginx.com     { nxt_string("subprotocol"), &nxt_py_subprotocol_str },
1111624Smax.romanov@nginx.com     { nxt_string("subprotocols"), &nxt_py_subprotocols_str },
1121624Smax.romanov@nginx.com     { nxt_string("text"), &nxt_py_text_str },
1131624Smax.romanov@nginx.com     { nxt_string("type"), &nxt_py_type_str },
114*2483Sdiguohuangjiajinweijun@gmail.com     { nxt_string("state"), &nxt_py_state_str },
1151624Smax.romanov@nginx.com     { nxt_string("version"), &nxt_py_version_str },
1161624Smax.romanov@nginx.com     { nxt_string("websocket"), &nxt_py_websocket_str },
1171624Smax.romanov@nginx.com     { nxt_string("websocket.accept"), &nxt_py_websocket_accept_str },
1181624Smax.romanov@nginx.com     { nxt_string("websocket.close"), &nxt_py_websocket_close_str },
1191624Smax.romanov@nginx.com     { nxt_string("websocket.connect"), &nxt_py_websocket_connect_str },
1201624Smax.romanov@nginx.com     { nxt_string("websocket.disconnect"), &nxt_py_websocket_disconnect_str },
1211624Smax.romanov@nginx.com     { nxt_string("websocket.receive"), &nxt_py_websocket_receive_str },
1221624Smax.romanov@nginx.com     { nxt_string("websocket.send"), &nxt_py_websocket_send_str },
1231624Smax.romanov@nginx.com     { nxt_string("ws"), &nxt_py_ws_str },
1241624Smax.romanov@nginx.com     { nxt_string("wss"), &nxt_py_wss_str },
1251624Smax.romanov@nginx.com     { nxt_null_string, NULL },
1261624Smax.romanov@nginx.com };
1271624Smax.romanov@nginx.com 
1281624Smax.romanov@nginx.com 
1291681Smax.romanov@nginx.com int
nxt_py_asgi_str_init(void)1301624Smax.romanov@nginx.com nxt_py_asgi_str_init(void)
1311624Smax.romanov@nginx.com {
1321624Smax.romanov@nginx.com     return nxt_python_init_strings(nxt_py_asgi_strings);
1331624Smax.romanov@nginx.com }
1341624Smax.romanov@nginx.com 
1351624Smax.romanov@nginx.com 
1361624Smax.romanov@nginx.com void
nxt_py_asgi_str_done(void)1371624Smax.romanov@nginx.com nxt_py_asgi_str_done(void)
1381624Smax.romanov@nginx.com {
1391624Smax.romanov@nginx.com     nxt_python_done_strings(nxt_py_asgi_strings);
1401624Smax.romanov@nginx.com }
1411624Smax.romanov@nginx.com 
1421624Smax.romanov@nginx.com 
1431624Smax.romanov@nginx.com #endif /* NXT_HAVE_ASGI */
144