Lines Matching refs:srv
118 static int server_match(const struct server *srv, const struct server_filter *f) in server_match() argument
122 if (f->service != 0 && srv->service != f->service) in server_match()
126 return (srv->instance & ifilter) == f->instance; in server_match()
141 struct server *srv; in server_query() local
143 srv = map_iter_data(me, struct server, mi); in server_query()
144 if (!server_match(srv, f)) in server_query()
147 list_append(list, &srv->qli); in server_query()
157 struct server *srv) in service_announce_new() argument
163 srv->service, srv->instance, srv->node, srv->port); in service_announce_new()
166 cmsg.server.service = cpu_to_le32(srv->service); in service_announce_new()
167 cmsg.server.instance = cpu_to_le32(srv->instance); in service_announce_new()
168 cmsg.server.node = cpu_to_le32(srv->node); in service_announce_new()
169 cmsg.server.port = cpu_to_le32(srv->port); in service_announce_new()
181 struct server *srv) in service_announce_del() argument
187 srv->service, srv->instance, srv->node, srv->port); in service_announce_del()
190 cmsg.server.service = cpu_to_le32(srv->service); in service_announce_del()
191 cmsg.server.instance = cpu_to_le32(srv->instance); in service_announce_del()
192 cmsg.server.node = cpu_to_le32(srv->node); in service_announce_del()
193 cmsg.server.port = cpu_to_le32(srv->port); in service_announce_del()
204 struct server *srv, bool new) in lookup_notify() argument
210 if (srv) { in lookup_notify()
211 pkt.server.service = cpu_to_le32(srv->service); in lookup_notify()
212 pkt.server.instance = cpu_to_le32(srv->instance); in lookup_notify()
213 pkt.server.node = cpu_to_le32(srv->node); in lookup_notify()
214 pkt.server.port = cpu_to_le32(srv->port); in lookup_notify()
227 struct server *srv; in annouce_servers() local
236 srv = map_iter_data(me, struct server, mi); in annouce_servers()
238 rc = service_announce_new(ctx, sq, srv); in annouce_servers()
250 struct server *srv; in server_add() local
257 srv = calloc(1, sizeof(*srv)); in server_add()
258 if (srv == NULL) in server_add()
261 srv->service = service; in server_add()
262 srv->instance = instance; in server_add()
263 srv->node = node_id; in server_add()
264 srv->port = port; in server_add()
270 rc = map_reput(&node->services, hash_u32(port), &srv->mi, &mi); in server_add()
274 LOGD("add server [%d:%x]@[%d:%d]\n", srv->service, srv->instance, in server_add()
275 srv->node, srv->port); in server_add()
282 return srv; in server_add()
285 free(srv); in server_add()
294 struct server *srv; in server_del() local
300 srv = container_of(mi, struct server, mi); in server_del()
301 map_remove(&node->services, srv->mi.key); in server_del()
304 if (srv->node == ctx->local_node) in server_del()
305 service_announce_del(ctx, &ctx->bcast_sq, srv); in server_del()
310 if (lookup->service && lookup->service != srv->service) in server_del()
312 if (lookup->instance && lookup->instance != srv->instance) in server_del()
315 lookup_notify(ctx, &lookup->sq, srv, false); in server_del()
318 free(srv); in server_del()
341 struct server *srv; in ctrl_cmd_bye() local
350 srv = map_iter_data(me, struct server, mi); in ctrl_cmd_bye()
352 server_del(ctx, node, srv->port); in ctrl_cmd_bye()
365 srv = map_iter_data(me, struct server, mi); in ctrl_cmd_bye()
368 sq.sq_node = srv->node; in ctrl_cmd_bye()
369 sq.sq_port = srv->port; in ctrl_cmd_bye()
390 struct server *srv; in ctrl_cmd_del_client() local
429 srv = map_iter_data(me, struct server, mi); in ctrl_cmd_del_client()
432 sq.sq_node = srv->node; in ctrl_cmd_del_client()
433 sq.sq_port = srv->port; in ctrl_cmd_del_client()
450 struct server *srv; in ctrl_cmd_new_server() local
463 srv = server_add(service, instance, node_id, port); in ctrl_cmd_new_server()
464 if (!srv) in ctrl_cmd_new_server()
467 if (srv->node == ctx->local_node) in ctrl_cmd_new_server()
468 rc = service_announce_new(ctx, &ctx->bcast_sq, srv); in ctrl_cmd_new_server()
477 lookup_notify(ctx, &lookup->sq, srv, true); in ctrl_cmd_new_server()
518 struct server *srv; in ctrl_cmd_new_lookup() local
539 srv = container_of(li, struct server, qli); in ctrl_cmd_new_lookup()
541 lookup_notify(ctx, from, srv, true); in ctrl_cmd_new_lookup()