From owner-p4-projects@FreeBSD.ORG Sun Jul 1 10:36:23 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CDB1916A473; Sun, 1 Jul 2007 10:36:22 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8E82716A46E for ; Sun, 1 Jul 2007 10:36:22 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 7513E13C465 for ; Sun, 1 Jul 2007 10:36:22 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l61AaMjh000152 for ; Sun, 1 Jul 2007 10:36:22 GMT (envelope-from andrew@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l61AaMd8000149 for perforce@freebsd.org; Sun, 1 Jul 2007 10:36:22 GMT (envelope-from andrew@freebsd.org) Date: Sun, 1 Jul 2007 10:36:22 GMT Message-Id: <200707011036.l61AaMd8000149@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to andrew@freebsd.org using -f From: Andrew Turner To: Perforce Change Reviews Cc: Subject: PERFORCE change 122631 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jul 2007 10:36:23 -0000 http://perforce.freebsd.org/chv.cgi?CH=122631 Change 122631 by andrew@andrew_hermies on 2007/07/01 10:35:48 Add a stub callback for all valid requests Make the list_updates callback print it's arguments Affected files ... .. //depot/projects/soc2007/andrew-update/backend/facund-be.c#10 edit Differences ... ==== //depot/projects/soc2007/andrew-update/backend/facund-be.c#10 (text+ko) ==== @@ -62,6 +62,16 @@ static struct facund_response *facund_call_ping(const char *, struct facund_object *); +static struct facund_response *facund_call_list_updates(const char *, + struct facund_object *); +static struct facund_response *facund_call_list_installed(const char *, + struct facund_object *); +static struct facund_response *facund_call_install_patches(const char *, + struct facund_object *); +static struct facund_response *facund_call_rollback_patches(const char *, + struct facund_object *); +static struct facund_response *facund_call_restart_services(const char *, + struct facund_object *); /* * Looks for updates on the system with a root of basedir @@ -275,6 +285,63 @@ return resp; } +static struct facund_response * +facund_call_list_updates(const char *id __unused, struct facund_object *obj __unused) +{ + const struct facund_object *cur; + unsigned int pos; + + if (obj == NULL) { + /* TODO: Don't use magic numbers */ + return facund_response_new(id, 1, "No data sent", NULL); + } + + switch (facund_object_get_type(obj)) { + case FACUND_STRING: + facund_object_print(obj); + break; + case FACUND_ARRAY: + for (pos = 0, cur = facund_object_get_array_item(obj, pos); + cur != NULL; pos++) { + facund_object_print(__DECONST(struct facund_object *, cur)); + } + break; + default: + return facund_response_new(id, 1, "Bad data sent", NULL); + break; + } + printf("STUB: %s\n", __func__); + return NULL; +} + +static struct facund_response * +facund_call_list_installed(const char *id __unused, struct facund_object *obj __unused) +{ + printf("STUB: %s\n", __func__); + return NULL; +} + +static struct facund_response * +facund_call_install_patches(const char *id __unused, struct facund_object *obj __unused) +{ + printf("STUB: %s\n", __func__); + return NULL; +} + +static struct facund_response * +facund_call_rollback_patches(const char *id __unused, struct facund_object *obj __unused) +{ + printf("STUB: %s\n", __func__); + return NULL; +} + +static struct facund_response * +facund_call_restart_services(const char *id __unused, struct facund_object *obj __unused) +{ + printf("STUB: %s\n", __func__); + return NULL; +} + int main(int argc __unused, char *argv[] __unused) { @@ -341,6 +408,11 @@ /* Add the callbacks for each call */ facund_server_add_call("ping", facund_call_ping); + facund_server_add_call("list_updates", facund_call_list_updates); + facund_server_add_call("list_installed", facund_call_list_installed); + facund_server_add_call("install_patches", facund_call_install_patches); + facund_server_add_call("rollback_patches",facund_call_rollback_patches); + facund_server_add_call("restart_services",facund_call_restart_services); pthread_create(&update_thread, NULL, look_for_updates, base_dirs); pthread_create(&comms_thread, NULL, do_communication, conn);