Lines Matching refs:out

235 def out(format, *args, **kwargs):
240 # def out(format, *args, new_line=True)
275 out("")
276 out("/* invokes a handler with a '%s' DBus signature */", signature)
277 out("static int invoke_%s_method(struct sbus_request *dbus_req, void *function_ptr);", signature)
280 out("")
281 out("/* invokes a handler with a '%s' DBus signature */", signature)
282 out("static int invoke_%s_method(struct sbus_request *dbus_req, void *function_ptr)", signature)
283 out("{")
287 out(" %s *arg_%d;", arg.dbus_type, i)
288 out(" int len_%d;", i)
290 out(" %s arg_%d;", arg.dbus_type, i)
291 out(" int (*handler)(struct sbus_request *, void *%s) = function_ptr;", method_arg_types(args))
292 out("")
293 out(" if (!sbus_request_parse_or_finish(dbus_req,")
297 out(" DBUS_TYPE_ARRAY, %s, &arg_%d, &len_%d,",
300 out(" %s, &arg_%d,", arg.dbus_constant, i)
301 out(" DBUS_TYPE_INVALID)) {")
302 out(" return EOK; /* request handled */")
303 out(" }")
304 out("")
306 out(" return (handler)(dbus_req, dbus_req->intf->handler_data", new_line=False)
309 out(",\n arg_%d", i, new_line=False)
311 out(",\n len_%d", i, new_line=False)
312 out(");")
313 out("}")
318 out(" %s *%sprop_val;", prop.sssd_type, prefix)
319 out(" int %sprop_len;", prefix)
320 out(" %s *%sout_val;", prop.dbus_type, prefix)
322 out(" %s %sprop_val;", prop.sssd_type, prefix)
323 out(" %s %sout_val;", prop.dbus_type, prefix)
327 out(" %s", prop.getter_signature("%shandler" % prefix), new_line=False)
328 out(";")
348 out("")
349 out("int %s_finish(struct sbus_request *req%s)",
351 out("{")
355 out(" %s cast_%s = arg_%s;", arg.dbus_type, arg.c_name(), arg.c_name())
357 out(" return sbus_request_return_and_finish(req,")
359 out(" ", new_line=False)
361 out("DBUS_TYPE_ARRAY, %s, &arg_%s, len_%s,",
364 out("%s, &cast_%s,", arg.dbus_constant, arg.c_name())
366 out("%s, &arg_%s,", arg.dbus_constant, arg.c_name())
367 out(" DBUS_TYPE_INVALID);")
368 out("}")
373 out(" %s *%s", arg.dbus_type, arg.c_name())
374 out(" int %s__len", arg.c_name())
376 out(" %s %s;", arg.dbus_type, arg.c_name())
380 out("")
381 out("/* arguments for %s.%s */", parent.iface.name, parent.name)
382 out("const struct sbus_arg_meta %s%s[] = {", parent.fq_c_name(), suffix)
384 out(" { \"%s\", \"%s\" },", arg.name, arg.type)
385 out(" { NULL, }")
386 out("};")
398 out("")
399 out("/* methods for %s */", iface.name)
400 out("const struct sbus_method_meta %s__methods[] = {", iface.c_name())
402 out(" {")
403 out(" \"%s\", /* name */", meth.name)
405 out(" %s__in,", meth.fq_c_name())
407 out(" NULL, /* no in_args */")
409 out(" %s__out,", meth.fq_c_name())
411 out(" NULL, /* no out_args */")
412 out(" offsetof(struct %s, %s),", iface.c_name(), meth.c_name())
414 out(" NULL, /* no invoker */")
416 out(" invoke_%s_method,", meth.in_signature())
417 out(" },")
418 out(" { NULL, }")
419 out("};")
426 out("")
427 out("/* signals for %s */", iface.name)
428 out("const struct sbus_signal_meta %s__signals[] = {", iface.c_name())
430 out(" {")
431 out(" \"%s\", /* name */", sig.name)
433 out(" %s__args", sig.fq_c_name())
435 out(" NULL, /* no args */")
436 out(" },")
437 out(" { NULL, }")
438 out("};")
441 out("")
442 out("/* property info for %s */", iface.name)
444 out("const struct sbus_property_meta %s__properties[] = {", iface.c_name())
446 out(" {")
447 out(" \"%s\", /* name */", prop.name)
448 out(" \"%s\", /* type */", prop.type)
450 out(" SBUS_PROPERTY_READABLE | SBUS_PROPERTY_WRITABLE,")
452 out(" SBUS_PROPERTY_READABLE,")
454 out(" SBUS_PROPERTY_WRITABLE,")
458 out(" offsetof(struct %s, %s),", iface.c_name(), prop.getter_name())
459 out(" %s,", prop.getter_invoker_name())
461 out(" 0, /* not readable */")
462 out(" NULL, /* no invoker */")
463 out(" 0, /* not writable */")
464 out(" NULL, /* no invoker */")
465 out(" },")
466 out(" { NULL, }")
467 out("};")
470 out("")
471 out("/* interface info for %s */", iface.name)
472 out("extern const struct sbus_interface_meta %s_meta;", iface.c_name())
475 out("")
476 out("/* interface info for %s */", iface.name)
477 out("const struct sbus_interface_meta %s_meta = {", iface.c_name())
478 out(" \"%s\", /* name */", iface.name)
480 out(" %s__methods,", iface.c_name())
482 out(" NULL, /* no methods */")
484 out(" %s__signals,", iface.c_name())
486 out(" NULL, /* no signals */")
488 out(" %s__properties,", iface.c_name())
490 out(" NULL, /* no properties */")
491 out(" sbus_invoke_get_all, /* GetAll invoker */")
492 out("};")
497 out("/* The following definitions are auto-generated from %s */", basename)
498 out("")
500 out("#include \"util/util.h\"")
501 out("#include \"sbus/sssd_dbus.h\"")
502 out("#include \"sbus/sssd_dbus_meta.h\"")
503 out("#include \"sbus/sssd_dbus_invokers.h\"")
505 out("#include \"%s\"", os.path.basename(include_header))
531 out("")
532 out("/* finish function for %s */", meth.name)
533 out("int %s_finish(struct sbus_request *req%s);",
537 out("")
538 out("/* vtable for %s */", iface.name)
539 out("struct %s {", iface.c_name())
540 out(" struct sbus_vtable vtable; /* derive from sbus_vtable */")
544 out(" %s;", method_function_pointer(meth, meth.c_name(), with_names=True))
546 out(" %s;", property_handlers(prop))
548 out("};")
551 out("")
552 out("/* constants for %s */", iface.name)
553 out("#define %s \"%s\"", iface.c_name().upper(), iface.name)
555 out("#define %s \"%s\"", meth.fq_c_name().upper(), meth.name)
557 out("#define %s \"%s\"", sig.fq_c_name().upper(), sig.name)
559 out("#define %s \"%s\"", prop.fq_c_name().upper(), prop.name)
565 out("/* The following declarations are auto-generated from %s */", basename)
566 out("")
567 out("#ifndef %s", guard)
568 out("#define %s", guard)
569 out("")
570 out("#include \"sbus/sssd_dbus.h\"")
572 out("")
573 out("/* ------------------------------------------------------------------------")
574 out(" * DBus Constants")
575 out(" *")
576 out(" * Various constants of interface and method names mostly for use by clients")
577 out(" */")
582 out("")
583 out("/* ------------------------------------------------------------------------")
584 out(" * DBus handlers")
585 out(" *")
586 out(" * These structures are filled in by implementors of the different")
587 out(" * dbus interfaces to handle method calls.")
588 out(" *")
589 out(" * Handler functions of type sbus_msg_handler_fn accept raw messages,")
590 out(" * other handlers are typed appropriately. If a handler that is")
591 out(" * set to NULL is invoked it will result in a")
592 out(" * org.freedesktop.DBus.Error.NotSupported error for the caller.")
593 out(" *")
594 out(" * Handlers have a matching xxx_finish() function (unless the method has")
595 out(" * accepts raw messages). These finish functions the")
596 out(" * sbus_request_return_and_finish() with the appropriate arguments to")
597 out(" * construct a valid reply. Once a finish function has been called, the")
598 out(" * @dbus_req it was called with is freed and no longer valid.")
599 out(" */")
607 out("")
608 out("/* ------------------------------------------------------------------------")
609 out(" * DBus Interface Metadata")
610 out(" *")
611 out(" * These structure definitions are filled in with the information about")
612 out(" * the interfaces, methods, properties and so on.")
613 out(" *")
614 out(" * The actual definitions are found in the accompanying C file next")
615 out(" * to this header.")
616 out(" */")
621 out("")
622 out("#endif /* %s */", guard)
736 elif direction == 'out':