#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/times.h>
#include <time.h>
#include <signal.h>
#include <ctype.h>
#include <libosso.h>
#include "codec.h"
#include <dbus/dbus-glib-lowlevel.h>
#include <assert.h>
#include "logging.h"
#include "server.h"
#include "libtime.h"
#include "clock_dbus.h"
Functions | |
static gboolean | handle_alarm (DBusConnection *bus) |
static int | read_conf () |
static int | save_conf (void) |
static int | get_dst (time_t tick) |
static int | get_utc_offset (time_t tick, int dst) |
static void | dump_date (void) |
static int | send_time_change_indication (time_t t) |
static int | set_time (time_t t) |
static DBusMessage * | server_new_rsp (DBusMessage *msg, int type,...) |
static DBusMessage * | server_set_time (DBusMessage *msg) |
static int | set_tz (const char *tz) |
static DBusMessage * | server_activate_net_time (DBusMessage *msg) |
static void | handle_csd_net_time_change (DBusMessage *msg) |
static DBusMessage * | server_get_time_format (DBusMessage *msg) |
static DBusMessage * | server_get_default_tz (DBusMessage *msg) |
static DBusMessage * | server_get_time (DBusMessage *msg) |
static DBusMessage * | server_set_time_format (DBusMessage *msg) |
static DBusMessage * | server_get_tz (DBusMessage *msg) |
static DBusMessage * | server_is_net_time_changed (DBusMessage *msg) |
static DBusMessage * | server_set_tz (DBusMessage *msg) |
static DBusMessage * | server_get_autosync (DBusMessage *msg) |
static DBusMessage * | server_set_autosync (DBusMessage *msg) |
static DBusMessage * | server_have_opertime (DBusMessage *msg) |
static DBusHandlerResult | server_filter (DBusConnection *conn, DBusMessage *msg, void *user_data) |
int | server_init (void) |
void | server_quit (void) |
Copyright (C) 2008 Nokia. All rights reserved.
static gboolean handle_alarm | ( | DBusConnection * | bus | ) | [static] |
Check DST change and send time change indication when DST changes.
static int read_conf | ( | ) | [static] |
static int save_conf | ( | void | ) | [static] |
Save current config to /home/user/.clockd.conf
Referenced by handle_csd_net_time_change(), server_filter(), server_init(), server_set_autosync(), server_set_time(), server_set_time_format(), and server_set_tz().
static int get_dst | ( | time_t | tick | ) | [static] |
Get daylight state
tick | Current time, 0 if not known |
Referenced by dump_date(), get_utc_offset(), handle_alarm(), handle_csd_net_time_change(), send_time_change_indication(), server_init(), time_get_dst_usage(), and time_get_tzname().
static int get_utc_offset | ( | time_t | tick, | |
int | dst | |||
) | [static] |
Get UTC offset
tick | Current time, 0 if not known | |
dst | nonzero if daylight is counted in |
Referenced by dump_date(), handle_csd_net_time_change(), time_get_time_diff(), and time_get_utc_offset().
static void dump_date | ( | void | ) | [static] |
Dump current date settings to syslog.
Referenced by handle_csd_net_time_change(), server_init(), server_set_time(), and server_set_tz().
static int send_time_change_indication | ( | time_t | t | ) | [static] |
Send "change" indication to all interested parties (via libosso).
t | Current time |
Referenced by handle_alarm(), handle_csd_net_time_change(), server_set_autosync(), server_set_time(), server_set_time_format(), and server_set_tz().
static int set_time | ( | time_t | t | ) | [static] |
Set system and RTC time using suidroot rclockd helper
t | Current time |
static DBusMessage* server_new_rsp | ( | DBusMessage * | msg, | |
int | type, | |||
... | ||||
) | [static] |
Create D-Bus method call response message
msg | request message | |
type | vararg type/value attributes |
Referenced by server_activate_net_time(), server_get_autosync(), server_get_default_tz(), server_get_time(), server_get_time_format(), server_get_tz(), server_have_opertime(), server_is_net_time_changed(), server_set_autosync(), server_set_time(), server_set_time_format(), and server_set_tz().
static DBusMessage* server_set_time | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus set_time method. Sets system/RTC time and sends time change indication with libosso.
msg | request message |
Referenced by server_filter().
static int set_tz | ( | const char * | tz | ) | [static] |
Set system timezone
tz | Timezone |
Referenced by server_init(), and server_set_tz().
static DBusMessage* server_activate_net_time | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus activate_net_time method. Sets system/RTC time and sends time change indication with libosso.
msg | request message |
Referenced by server_filter().
static void handle_csd_net_time_change | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus net_time_change signal from CSD. If network autosync is enabled, set system/RTC time and sends time change indication with libosso; otherwise just store the data (that can be activated with activate_net_time method later)
msg | signal message |
Referenced by server_filter().
static DBusMessage* server_get_time_format | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus get_time_fmt method
msg | request message |
Referenced by server_filter().
static DBusMessage* server_get_default_tz | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus get_default_tz method
msg | request message |
Referenced by server_filter().
static DBusMessage* server_get_time | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus get_time method
msg | request message |
Referenced by server_filter().
static DBusMessage* server_set_time_format | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus get_time_fmt method. Sets the time format locally and sends time change indication with libosso. Saves config to /home/user/.clockd.conf.
msg | request message |
Referenced by server_filter().
static DBusMessage* server_get_tz | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus get_tz method.
msg | request message |
Referenced by server_filter().
static DBusMessage* server_is_net_time_changed | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus is_net_time_changed method
msg | request message |
Referenced by server_filter().
static DBusMessage* server_set_tz | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus set_tz method. Sets the time zone and sends time change indication. Saves config to /home/user/.clockd.conf.
msg | request message |
Referenced by server_filter().
static DBusMessage* server_get_autosync | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus get_autosync method
msg | request message |
Referenced by server_filter().
static DBusMessage* server_set_autosync | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus set_autosync method. Set autosync on/off and sends time change indication with libosso. Saves config to /home/user/.clockd.conf.
msg | request message |
Referenced by server_filter().
static DBusMessage* server_have_opertime | ( | DBusMessage * | msg | ) | [static] |
Handle D-Bus have_opertime method
msg | request message |
Referenced by server_filter().
static DBusHandlerResult server_filter | ( | DBusConnection * | conn, | |
DBusMessage * | msg, | |||
void * | user_data | |||
) | [static] |
Handle requests (methods or signals) coming via D-Bus
conn | D-Bus connection | |
msg | D-Bus message | |
user_data | User data (not used) |
Referenced by server_init(), and server_quit().
int server_init | ( | void | ) |
Init D-Bus server
The following is set up:
Referenced by mainloop_run().
void server_quit | ( | void | ) |
Deinitialize D-Bus server
Referenced by mainloop_run().