| 1 | /* |
| 2 | * Copyright (c) 2015-2022 Joris Vink <[email protected]> |
| 3 | * |
| 4 | * Permission to use, copy, modify, and distribute this software for any |
| 5 | * purpose with or without fee is hereby granted, provided that the above |
| 6 | * copyright notice and this permission notice appear in all copies. |
| 7 | * |
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ |
| 16 | |
| 17 | #include <sys/types.h> |
| 18 | #include <sys/socket.h> |
| 19 | |
| 20 | #include <signal.h> |
| 21 | |
| 22 | #include "kore.h"cxx . . $ `<file>/include/kore/kore.h`/ |
| 23 | #include "http.h"cxx . . $ `<file>/include/kore/http.h`/ |
| 24 | |
| 25 | #if defined(KORE_USE_ACME) |
| 26 | #include "acme.h" |
| 27 | #endif |
| 28 | |
| 29 | struct msg_typecxx . . $ msg_type# { |
| 30 | u_int8_tcxx . . $ u_int8_t# idcxx . . $ msg_type#id.; |
| 31 | void (*cbcxx . . $ msg_type#cb.)(struct kore_msgcxx . . $ kore_msg# *, const void *); |
| 32 | TAILQ_ENTRYcxx . . $ `<external>/2546723208511035544/queue.h:382:9`!(msg_type) listcxx . . $ msg_type#list.; |
| 33 | }; |
| 34 | |
| 35 | static struct msg_typecxx . . $ msg_type# *msg_type_lookupcxx . . $ msg_type_lookup(8d0ceec9dda9c539).(u_int8_tcxx . . $ u_int8_t#); |
| 36 | static int msg_recv_datacxx . . $ msg_recv_data(82c4d452dc2a871a).(struct netbufcxx . . $ netbuf# *); |
| 37 | static int msg_recv_packetcxx . . $ msg_recv_packet(82c4d452dc2a871a).(struct netbufcxx . . $ netbuf# *); |
| 38 | static void msg_disconnected_workercxx . . $ msg_disconnected_worker(8475afdb72fd1ebb).(struct connectioncxx . . $ connection# *); |
| 39 | static void msg_type_shutdowncxx . . $ msg_type_shutdown(72fdcea79115518d).(struct kore_msgcxx . . $ kore_msg# *, const void *); |
| 40 | |
| 41 | #if !defined(KORE_NO_HTTP) |
| 42 | static void msg_type_websocketcxx . . $ msg_type_websocket(72fdcea79115518d).(struct kore_msgcxx . . $ kore_msg# *, const void *); |
| 43 | #endif |
| 44 | |
| 45 | static TAILQ_HEADcxx . . $ `<external>/2546723208511035544/queue.h:372:9`!(, msg_type) msg_typescxx . . $ msg_types.; |
| 46 | static size_t cacheidxcxx . . $ cacheidx. = 0; |
| 47 | static struct connectioncxx . . $ connection# **conncachecxx . . $ conncache. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 48 | |
| 49 | void |
| 50 | kore_msg_initcxx . . $ kore_msg_init(49f6e7a06ebc5aa8).(void) |
| 51 | { |
| 52 | TAILQ_INITcxx . . $ `<external>/2546723208511035544/queue.h:387:9`!(&msg_types); |
| 53 | } |
| 54 | |
| 55 | void |
| 56 | kore_msg_parent_initcxx . . $ kore_msg_parent_init(49f6e7a06ebc5aa8).(void) |
| 57 | { |
| 58 | u_int8_tcxx . . $ u_int8_t# idx; |
| 59 | struct kore_workercxx . . $ kore_worker# *kw; |
| 60 | |
| 61 | for (idx = 0; idx < worker_countcxx . . $ worker_count.; idx++) { |
| 62 | kw = kore_worker_datacxx . . $ kore_worker_data(a59abc2c9e0c50f4).(idx); |
| 63 | if (kw->pscxx . . $ kore_worker#ps. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 64 | kore_msg_parent_addcxx . . $ kore_msg_parent_add(8632b877e8ae27d6).(kw); |
| 65 | } |
| 66 | |
| 67 | kore_msg_registercxx . . $ kore_msg_register(96a8e3ca44e422f9).(KORE_MSG_FATALXcxx . . $ `include/kore/kore.h:672:9`!, msg_type_shutdowncxx . . $ msg_type_shutdown(72fdcea79115518d).); |
| 68 | kore_msg_registercxx . . $ kore_msg_register(96a8e3ca44e422f9).(KORE_MSG_SHUTDOWNcxx . . $ `include/kore/kore.h:663:9`!, msg_type_shutdowncxx . . $ msg_type_shutdown(72fdcea79115518d).); |
| 69 | } |
| 70 | |
| 71 | void |
| 72 | kore_msg_parent_addcxx . . $ kore_msg_parent_add(8632b877e8ae27d6).(struct kore_workercxx . . $ kore_worker# *kw) |
| 73 | { |
| 74 | kw->msgcxx . . $ kore_worker#msg.[0] = kore_connection_newcxx . . $ kore_connection_new(c7160e4f828b920c).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 75 | kw->msgcxx . . $ kore_worker#msg.[0]->fdcxx . . $ connection#fd. = kw->pipecxx . . $ kore_worker#pipe.[0]; |
| 76 | kw->msgcxx . . $ kore_worker#msg.[0]->readcxx . . $ connection#read. = net_readcxx . . $ net_read(6a0a663d3dbc77f8).; |
| 77 | kw->msgcxx . . $ kore_worker#msg.[0]->writecxx . . $ connection#write. = net_writecxx . . $ net_write(6baa9a301ab1221c).; |
| 78 | kw->msgcxx . . $ kore_worker#msg.[0]->protocxx . . $ connection#proto. = CONN_PROTO_MSGcxx . . $ `include/kore/kore.h:184:9`!; |
| 79 | kw->msgcxx . . $ kore_worker#msg.[0]->statecxx . . $ connection#state. = CONN_STATE_ESTABLISHEDcxx . . $ `include/kore/kore.h:178:9`!; |
| 80 | kw->msgcxx . . $ kore_worker#msg.[0]->hdlr_extracxx . . $ connection#hdlr_extra. = &kw->idcxx . . $ kore_worker#id.; |
| 81 | kw->msgcxx . . $ kore_worker#msg.[0]->disconnectcxx . . $ connection#disconnect. = msg_disconnected_workercxx . . $ msg_disconnected_worker(8475afdb72fd1ebb).; |
| 82 | kw->msgcxx . . $ kore_worker#msg.[0]->handlecxx . . $ connection#handle. = kore_connection_handlecxx . . $ kore_connection_handle(d3ce87d3c6fa6963).; |
| 83 | |
| 84 | conncachecxx . . $ conncache. = kore_realloccxx . . $ kore_realloc(417ab160f6baadc6).(conncachecxx . . $ conncache., |
| 85 | (cacheidxcxx . . $ cacheidx. + 1) * sizeof(struct connectioncxx . . $ connection# *)); |
| 86 | |
| 87 | conncachecxx . . $ conncache.[cacheidxcxx . . $ cacheidx.++] = kw->msgcxx . . $ kore_worker#msg.[0]; |
| 88 | |
| 89 | TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&connections, kw->msg[0], list); |
| 90 | kore_platform_event_allcxx . . $ kore_platform_event_all(6ca3d68f5c5f0975).(kw->msgcxx . . $ kore_worker#msg.[0]->fdcxx . . $ connection#fd., kw->msgcxx . . $ kore_worker#msg.[0]); |
| 91 | |
| 92 | net_recv_queuecxx . . $ net_recv_queue(8cd27e823268687f).(kw->msgcxx . . $ kore_worker#msg.[0], sizeof(struct kore_msgcxx . . $ kore_msg#), 0, msg_recv_packetcxx . . $ msg_recv_packet(82c4d452dc2a871a).); |
| 93 | } |
| 94 | |
| 95 | void |
| 96 | kore_msg_parent_removecxx . . $ kore_msg_parent_remove(8632b877e8ae27d6).(struct kore_workercxx . . $ kore_worker# *kw) |
| 97 | { |
| 98 | kore_connection_disconnectcxx . . $ kore_connection_disconnect(8475afdb72fd1ebb).(kw->msgcxx . . $ kore_worker#msg.[0]); |
| 99 | kore_connection_prunecxx . . $ kore_connection_prune(d4f767463ce0a6b3).(KORE_CONNECTION_PRUNE_DISCONNECTcxx . . $ `include/kore/kore.h:214:9`!); |
| 100 | (void)closecxx . . $ close(7864480464b09eea).(kw->pipecxx . . $ kore_worker#pipe.[1]); |
| 101 | } |
| 102 | |
| 103 | void |
| 104 | kore_msg_worker_initcxx . . $ kore_msg_worker_init(49f6e7a06ebc5aa8).(void) |
| 105 | { |
| 106 | #if !defined(KORE_NO_HTTP) |
| 107 | kore_msg_registercxx . . $ kore_msg_register(96a8e3ca44e422f9).(KORE_MSG_WEBSOCKETcxx . . $ `include/kore/kore.h:660:9`!, msg_type_websocketcxx . . $ msg_type_websocket(72fdcea79115518d).); |
| 108 | #endif |
| 109 | |
| 110 | workercxx . . $ worker.->msgcxx . . $ kore_worker#msg.[1] = kore_connection_newcxx . . $ kore_connection_new(c7160e4f828b920c).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 111 | workercxx . . $ worker.->msgcxx . . $ kore_worker#msg.[1]->fdcxx . . $ connection#fd. = workercxx . . $ worker.->pipecxx . . $ kore_worker#pipe.[1]; |
| 112 | workercxx . . $ worker.->msgcxx . . $ kore_worker#msg.[1]->readcxx . . $ connection#read. = net_readcxx . . $ net_read(6a0a663d3dbc77f8).; |
| 113 | workercxx . . $ worker.->msgcxx . . $ kore_worker#msg.[1]->writecxx . . $ connection#write. = net_writecxx . . $ net_write(6baa9a301ab1221c).; |
| 114 | workercxx . . $ worker.->msgcxx . . $ kore_worker#msg.[1]->protocxx . . $ connection#proto. = CONN_PROTO_MSGcxx . . $ `include/kore/kore.h:184:9`!; |
| 115 | workercxx . . $ worker.->msgcxx . . $ kore_worker#msg.[1]->statecxx . . $ connection#state. = CONN_STATE_ESTABLISHEDcxx . . $ `include/kore/kore.h:178:9`!; |
| 116 | workercxx . . $ worker.->msgcxx . . $ kore_worker#msg.[1]->handlecxx . . $ connection#handle. = kore_connection_handlecxx . . $ kore_connection_handle(d3ce87d3c6fa6963).; |
| 117 | workercxx . . $ worker.->msgcxx . . $ kore_worker#msg.[1]->evtcxx . . $ connection#evt..flagscxx . . $ kore_event#flags. = KORE_EVENT_WRITEcxx . . $ `include/kore/kore.h:188:9`!; |
| 118 | |
| 119 | TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&connections, worker->msg[1], list); |
| 120 | kore_platform_event_allcxx . . $ kore_platform_event_all(6ca3d68f5c5f0975).(workercxx . . $ worker.->msgcxx . . $ kore_worker#msg.[1]->fdcxx . . $ connection#fd., workercxx . . $ worker.->msgcxx . . $ kore_worker#msg.[1]); |
| 121 | |
| 122 | net_recv_queuecxx . . $ net_recv_queue(8cd27e823268687f).(workercxx . . $ worker.->msgcxx . . $ kore_worker#msg.[1], |
| 123 | sizeof(struct kore_msgcxx . . $ kore_msg#), 0, msg_recv_packetcxx . . $ msg_recv_packet(82c4d452dc2a871a).); |
| 124 | } |
| 125 | |
| 126 | void |
| 127 | kore_msg_unregistercxx . . $ kore_msg_unregister(ac50b47256ae7414).(u_int8_tcxx . . $ u_int8_t# id) |
| 128 | { |
| 129 | struct msg_typecxx . . $ msg_type# *type; |
| 130 | |
| 131 | if ((type = msg_type_lookupcxx . . $ msg_type_lookup(8d0ceec9dda9c539).(id)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 132 | return; |
| 133 | |
| 134 | TAILQ_REMOVEcxx . . $ `<external>/2546723208511035544/queue.h:426:9`!(&msg_types, type, list); |
| 135 | kore_freecxx . . $ kore_free(5d22bdacc48458e8).(type); |
| 136 | } |
| 137 | |
| 138 | int |
| 139 | kore_msg_registercxx . . $ kore_msg_register(96a8e3ca44e422f9).(u_int8_tcxx . . $ u_int8_t# id, void (*cb)(struct kore_msgcxx . . $ kore_msg# *, const void *)) |
| 140 | { |
| 141 | struct msg_typecxx . . $ msg_type# *type; |
| 142 | |
| 143 | if (msg_type_lookupcxx . . $ msg_type_lookup(8d0ceec9dda9c539).(id) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 144 | return (KORE_RESULT_ERRORcxx . . $ `include/kore/kore.h:87:9`!); |
| 145 | |
| 146 | type = kore_malloccxx . . $ kore_malloc(bfcfa4d6b7f7ef64).(sizeof(*type)); |
| 147 | type->idcxx . . $ msg_type#id. = id; |
| 148 | type->cbcxx . . $ msg_type#cb. = cb; |
| 149 | TAILQ_INSERT_TAILcxx . . $ `<external>/2546723208511035544/queue.h:402:9`!(&msg_types, type, list); |
| 150 | |
| 151 | return (KORE_RESULT_OKcxx . . $ `include/kore/kore.h:88:9`!); |
| 152 | } |
| 153 | |
| 154 | void |
| 155 | kore_msg_sendcxx . . $ kore_msg_send(6afaa3cccbe95a50).(u_int16_tcxx . . $ u_int16_t# dst, u_int8_tcxx . . $ u_int8_t# id, const void *data, size_t len) |
| 156 | { |
| 157 | struct kore_msgcxx . . $ kore_msg# m; |
| 158 | struct connectioncxx . . $ connection# *c; |
| 159 | struct kore_workercxx . . $ kore_worker# *kw; |
| 160 | |
| 161 | m.idcxx . . $ kore_msg#id. = id; |
| 162 | m.dstcxx . . $ kore_msg#dst. = dst; |
| 163 | m.lengthcxx . . $ kore_msg#length. = len; |
| 164 | |
| 165 | if (workercxx . . $ worker. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 166 | m.srccxx . . $ kore_msg#src. = KORE_MSG_PARENTcxx . . $ `include/kore/kore.h:679:9`!; |
| 167 | |
| 168 | if ((kw = kore_worker_data_byidcxx . . $ kore_worker_data_byid(b637c7c675a79ce6).(dst)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 169 | kore_logcxx . . $ kore_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, "no such worker by id %u", dst); |
| 170 | return; |
| 171 | } |
| 172 | |
| 173 | c = kw->msgcxx . . $ kore_worker#msg.[0]; |
| 174 | m.dstcxx . . $ kore_msg#dst. = kw->idcxx . . $ kore_worker#id.; |
| 175 | } else { |
| 176 | m.srccxx . . $ kore_msg#src. = workercxx . . $ worker.->idcxx . . $ kore_worker#id.; |
| 177 | c = workercxx . . $ worker.->msgcxx . . $ kore_worker#msg.[1]; |
| 178 | } |
| 179 | |
| 180 | net_send_queuecxx . . $ net_send_queue(afc888e1ea7fb691).(c, &m, sizeof(m)); |
| 181 | if (data != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && len > 0) |
| 182 | net_send_queuecxx . . $ net_send_queue(afc888e1ea7fb691).(c, data, len); |
| 183 | |
| 184 | net_send_flushcxx . . $ net_send_flush(d3ce87d3c6fa6963).(c); |
| 185 | } |
| 186 | |
| 187 | static int |
| 188 | msg_recv_packetcxx . . $ msg_recv_packet(82c4d452dc2a871a).(struct netbufcxx . . $ netbuf# *nb) |
| 189 | { |
| 190 | struct kore_msgcxx . . $ kore_msg# *msg = (struct kore_msgcxx . . $ kore_msg# *)nb->bufcxx . . $ netbuf#buf.; |
| 191 | |
| 192 | if (msg->lengthcxx . . $ kore_msg#length. > 0) { |
| 193 | net_recv_expandcxx . . $ net_recv_expand(174c4f3588921332).(nb->ownercxx . . $ netbuf#owner., msg->lengthcxx . . $ kore_msg#length., msg_recv_datacxx . . $ msg_recv_data(82c4d452dc2a871a).); |
| 194 | return (KORE_RESULT_OKcxx . . $ `include/kore/kore.h:88:9`!); |
| 195 | } |
| 196 | |
| 197 | return (msg_recv_datacxx . . $ msg_recv_data(82c4d452dc2a871a).(nb)); |
| 198 | } |
| 199 | |
| 200 | static int |
| 201 | msg_recv_datacxx . . $ msg_recv_data(82c4d452dc2a871a).(struct netbufcxx . . $ netbuf# *nb) |
| 202 | { |
| 203 | size_t i; |
| 204 | struct connectioncxx . . $ connection# *c; |
| 205 | struct msg_typecxx . . $ msg_type# *type; |
| 206 | int deliver; |
| 207 | u_int16_tcxx . . $ u_int16_t# dst, destination; |
| 208 | struct kore_msgcxx . . $ kore_msg# *msg = (struct kore_msgcxx . . $ kore_msg# *)nb->bufcxx . . $ netbuf#buf.; |
| 209 | |
| 210 | if ((type = msg_type_lookupcxx . . $ msg_type_lookup(8d0ceec9dda9c539).(msg->idcxx . . $ kore_msg#id.)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 211 | if (workercxx . . $ worker. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && msg->dstcxx . . $ kore_msg#dst. != KORE_MSG_PARENTcxx . . $ `include/kore/kore.h:679:9`!) |
| 212 | fatalcxx . . $ fatal(f6bc48f0426f26ee).("received parent msg for non parent dst"); |
| 213 | if (workercxx . . $ worker. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && msg->dstcxx . . $ kore_msg#dst. != workercxx . . $ worker.->idcxx . . $ kore_worker#id.) |
| 214 | fatalcxx . . $ fatal(f6bc48f0426f26ee).("received message for incorrect worker"); |
| 215 | |
| 216 | if (msg->lengthcxx . . $ kore_msg#length. > 0) |
| 217 | type->cbcxx . . $ msg_type#cb.(msg, nb->bufcxx . . $ netbuf#buf. + sizeof(*msg)); |
| 218 | else |
| 219 | type->cbcxx . . $ msg_type#cb.(msg, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 220 | } |
| 221 | |
| 222 | if (workercxx . . $ worker. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && type == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 223 | destination = msg->dstcxx . . $ kore_msg#dst.; |
| 224 | |
| 225 | for (i = 0; i < cacheidxcxx . . $ cacheidx.; i++) { |
| 226 | c = conncachecxx . . $ conncache.[i]; |
| 227 | if (c->protocxx . . $ connection#proto. != CONN_PROTO_MSGcxx . . $ `include/kore/kore.h:184:9`!) |
| 228 | fatalcxx . . $ fatal(f6bc48f0426f26ee).("connection not a msg connection"); |
| 229 | |
| 230 | /* |
| 231 | * If hdlr_extra is NULL it just means the worker |
| 232 | * never started, ignore it. |
| 233 | */ |
| 234 | if (c->hdlr_extracxx . . $ connection#hdlr_extra. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 235 | continue; |
| 236 | |
| 237 | deliver = 1; |
| 238 | dst = *(u_int16_tcxx . . $ u_int16_t# *)c->hdlr_extracxx . . $ connection#hdlr_extra.; |
| 239 | |
| 240 | if (destination == KORE_MSG_WORKER_ALLcxx . . $ `include/kore/kore.h:680:9`!) { |
| 241 | if (kore_keymgr_activecxx . . $ kore_keymgr_active. && dst == 0) |
| 242 | deliver = 0; |
| 243 | } else { |
| 244 | if (dst != destination) |
| 245 | deliver = 0; |
| 246 | } |
| 247 | |
| 248 | if (deliver == 0) |
| 249 | continue; |
| 250 | |
| 251 | /* This allows the worker to receive the correct id. */ |
| 252 | msg->dstcxx . . $ kore_msg#dst. = *(u_int16_tcxx . . $ u_int16_t# *)c->hdlr_extracxx . . $ connection#hdlr_extra.; |
| 253 | |
| 254 | net_send_queuecxx . . $ net_send_queue(afc888e1ea7fb691).(c, nb->bufcxx . . $ netbuf#buf., nb->s_offcxx . . $ netbuf#s_off.); |
| 255 | net_send_flushcxx . . $ net_send_flush(d3ce87d3c6fa6963).(c); |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | net_recv_resetcxx . . $ net_recv_reset(174c4f3588921332).(nb->ownercxx . . $ netbuf#owner., sizeof(struct kore_msgcxx . . $ kore_msg#), msg_recv_packetcxx . . $ msg_recv_packet(82c4d452dc2a871a).); |
| 260 | return (KORE_RESULT_OKcxx . . $ `include/kore/kore.h:88:9`!); |
| 261 | } |
| 262 | |
| 263 | static void |
| 264 | msg_disconnected_workercxx . . $ msg_disconnected_worker(8475afdb72fd1ebb).(struct connectioncxx . . $ connection# *c) |
| 265 | { |
| 266 | c->hdlr_extracxx . . $ connection#hdlr_extra. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 267 | } |
| 268 | |
| 269 | static void |
| 270 | msg_type_shutdowncxx . . $ msg_type_shutdown(72fdcea79115518d).(struct kore_msgcxx . . $ kore_msg# *msg, const void *data) |
| 271 | { |
| 272 | if (!kore_quietcxx . . $ kore_quiet.) { |
| 273 | kore_logcxx . . $ kore_log(afcfcee7634adf7d).(LOG_NOTICEcxx . . $ `<external>/6168640806541382331/syslog.h:56:9`!, |
| 274 | "shutdown requested by worker %u, going down", msg->srccxx . . $ kore_msg#src.); |
| 275 | } |
| 276 | |
| 277 | if (msg->idcxx . . $ kore_msg#id. == KORE_MSG_FATALXcxx . . $ `include/kore/kore.h:672:9`!) |
| 278 | kore_quitcxx . . $ kore_quit. = KORE_QUIT_FATALcxx . . $ `include/kore/kore.h:85:9`!; |
| 279 | else |
| 280 | kore_quitcxx . . $ kore_quit. = KORE_QUIT_NORMALcxx . . $ `include/kore/kore.h:84:9`!; |
| 281 | } |
| 282 | |
| 283 | #if !defined(KORE_NO_HTTP) |
| 284 | static void |
| 285 | msg_type_websocketcxx . . $ msg_type_websocket(72fdcea79115518d).(struct kore_msgcxx . . $ kore_msg# *msg, const void *data) |
| 286 | { |
| 287 | struct connectioncxx . . $ connection# *c; |
| 288 | |
| 289 | TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(c, &connections, list) { |
| 290 | if (c->protocxx . . $ connection#proto. == CONN_PROTO_WEBSOCKETcxx . . $ `include/kore/kore.h:183:9`!) { |
| 291 | net_send_queuecxx . . $ net_send_queue(afc888e1ea7fb691).(c, data, msg->lengthcxx . . $ kore_msg#length.); |
| 292 | net_send_flushcxx . . $ net_send_flush(d3ce87d3c6fa6963).(c); |
| 293 | } |
| 294 | } |
| 295 | } |
| 296 | #endif |
| 297 | |
| 298 | static struct msg_typecxx . . $ msg_type# * |
| 299 | msg_type_lookupcxx . . $ msg_type_lookup(8d0ceec9dda9c539).(u_int8_tcxx . . $ u_int8_t# id) |
| 300 | { |
| 301 | struct msg_typecxx . . $ msg_type# *type; |
| 302 | |
| 303 | TAILQ_FOREACHcxx . . $ `<external>/2546723208511035544/queue.h:435:9`!(type, &msg_types, list) { |
| 304 | if (type->idcxx . . $ msg_type#id. == id) |
| 305 | return (type); |
| 306 | } |
| 307 | |
| 308 | return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 309 | } |