source: roaraudio/plugins/universal/protocol-daytime.c @ 5434:1bbcec2d01e9

Last change on this file since 5434:1bbcec2d01e9 was 5434:1bbcec2d01e9, checked in by phi, 10 years ago

use better plugin names

File size: 2.3 KB
Line 
1//daytime.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2012
5 *
6 *  This file is part of roard a part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  RoarAudio is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU General Public License for more details.
18 *
19 *  You should have received a copy of the GNU General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 *  Boston, MA 02110-1301, USA.
23 *
24 */
25
26#include <roard/include/roard.h>
27
28int new_client(int client, struct roar_vio_calls * vio, struct roard_listen * lsock) {
29 struct roar_buffer * buf;
30 void * data;
31 ssize_t len;
32 time_t now = time(NULL);
33 char * date = asctime(gmtime(&now));
34
35 (void)vio, (void)lsock;
36
37 ROAR_DBG("new_client(client=%i, vio=%p, lsock=%p) = ?", client, vio, lsock);
38
39 len = roar_mm_strlen(date) + 1;
40
41 if ( roar_buffer_new_data(&buf, len, &data) == -1 )
42  return -1;
43
44 memcpy(data, date, len);
45
46 clients_add_output(client, &buf);
47
48 ROAR_DBG("new_client(client=%i, vio=%p, lsock=%p) = 0", client, vio, lsock);
49 return 0;
50}
51
52static int flushed_client(int client, struct roar_vio_calls * vio) {
53 (void)vio;
54
55 clients_delete(client);
56
57 return 0;
58}
59
60static struct roard_proto proto[1] = {
61 {ROAR_PROTO_DAYTIME, ROAR_SUBSYS_NONE, "The Internet daytime protocol", NULL, new_client, NULL, NULL, flushed_client}
62};
63
64ROARD_DL_REG_PROTO(proto)
65
66ROAR_DL_PLUGIN_START(protocol_daytime) {
67 ROARD_DL_CHECK_VERSIONS();
68
69 ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-daytime", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
70 ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
71 ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
72 ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
73 ROAR_DL_PLUGIN_META_DESC("Implementation of the Internet daytime protocol");
74
75 ROARD_DL_REGFN_PROTO();
76} ROAR_DL_PLUGIN_END
77
78//ll
Note: See TracBrowser for help on using the repository browser.