1 /**
2 * collectd - src/teamspeak2.c
3 * Copyright (C) 2008 Stefan Hacker
4 * Copyright (C) 2008 Florian Forster
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; only version 2 of the License is applicable.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Authors:
20 * Stefan Hacker <d0t at dbclan dot de>
21 * Florian Forster <octo at collectd.org>
22 **/
24 #include "collectd.h"
25 #include "common.h"
26 #include "plugin.h"
28 #include <netinet/in.h>
29 #include <arpa/inet.h>
30 #include <sys/types.h>
31 #include <netdb.h>
33 /*
34 * Defines
35 */
36 /* Default host and port */
37 #define DEFAULT_HOST "127.0.0.1"
38 #define DEFAULT_PORT "51234"
40 /*
41 * Variables
42 */
43 /* Server linked list structure */
44 typedef struct vserver_list_s
45 {
46 int port;
47 struct vserver_list_s *next;
48 } vserver_list_t;
49 static vserver_list_t *server_list = NULL;
51 /* Host data */
52 static char *config_host = NULL;
53 static char *config_port = NULL;
55 static FILE *global_read_fh = NULL;
56 static FILE *global_write_fh = NULL;
58 /* Config data */
59 static const char *config_keys[] =
60 {
61 "Host",
62 "Port",
63 "Server"
64 };
65 static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
67 /*
68 * Functions
69 */
70 static int tss2_add_vserver (int vserver_port)
71 {
72 /*
73 * Adds a new vserver to the linked list
74 */
75 vserver_list_t *entry;
77 /* Check port range */
78 if ((vserver_port <= 0) || (vserver_port > 65535))
79 {
80 ERROR ("teamspeak2 plugin: VServer port is invalid: %i",
81 vserver_port);
82 return (-1);
83 }
85 /* Allocate memory */
86 entry = malloc (sizeof (*entry));
87 if (entry == NULL)
88 {
89 ERROR ("teamspeak2 plugin: malloc failed.");
90 return (-1);
91 }
92 memset (entry, 0, sizeof (vserver_list_t));
94 /* Save data */
95 entry->port = vserver_port;
97 /* Insert to list */
98 if(server_list == NULL) {
99 /* Add the server as the first element */
100 server_list = entry;
101 }
102 else {
103 vserver_list_t *prev;
105 /* Add the server to the end of the list */
106 prev = server_list;
107 while (prev->next != NULL)
108 prev = prev->next;
109 prev->next = entry;
110 }
112 INFO ("teamspeak2 plugin: Registered new vserver: %i", vserver_port);
114 return (0);
115 } /* int tss2_add_vserver */
117 static void tss2_submit_gauge (const char *plugin_instance,
118 const char *type, const char *type_instance,
119 gauge_t value)
120 {
121 /*
122 * Submits a gauge value to the collectd daemon
123 */
124 value_t values[1];
125 value_list_t vl = VALUE_LIST_INIT;
127 values[0].gauge = value;
129 vl.values = values;
130 vl.values_len = 1;
131 sstrncpy (vl.host, hostname_g, sizeof (vl.host));
132 sstrncpy (vl.plugin, "teamspeak2", sizeof (vl.plugin));
134 if (plugin_instance != NULL)
135 sstrncpy (vl.plugin_instance, plugin_instance,
136 sizeof (vl.plugin_instance));
138 sstrncpy (vl.type, type, sizeof (vl.type));
140 if (type_instance != NULL)
141 sstrncpy (vl.type_instance, type_instance,
142 sizeof (vl.type_instance));
144 plugin_dispatch_values (&vl);
145 } /* void tss2_submit_gauge */
147 static void tss2_submit_io (const char *plugin_instance, const char *type,
148 derive_t rx, derive_t tx)
149 {
150 /*
151 * Submits the io rx/tx tuple to the collectd daemon
152 */
153 value_t values[2];
154 value_list_t vl = VALUE_LIST_INIT;
156 values[0].derive = rx;
157 values[1].derive = tx;
159 vl.values = values;
160 vl.values_len = 2;
161 sstrncpy (vl.host, hostname_g, sizeof (vl.host));
162 sstrncpy (vl.plugin, "teamspeak2", sizeof (vl.plugin));
164 if (plugin_instance != NULL)
165 sstrncpy (vl.plugin_instance, plugin_instance,
166 sizeof (vl.plugin_instance));
168 sstrncpy (vl.type, type, sizeof (vl.type));
170 plugin_dispatch_values (&vl);
171 } /* void tss2_submit_gauge */
173 static void tss2_close_socket (void)
174 {
175 /*
176 * Closes all sockets
177 */
178 if (global_write_fh != NULL)
179 {
180 fputs ("quit\r\n", global_write_fh);
181 }
183 if (global_read_fh != NULL)
184 {
185 fclose (global_read_fh);
186 global_read_fh = NULL;
187 }
189 if (global_write_fh != NULL)
190 {
191 fclose (global_write_fh);
192 global_write_fh = NULL;
193 }
194 } /* void tss2_close_socket */
196 static int tss2_get_socket (FILE **ret_read_fh, FILE **ret_write_fh)
197 {
198 /*
199 * Returns connected file objects or establishes the connection
200 * if it's not already present
201 */
202 struct addrinfo ai_hints;
203 struct addrinfo *ai_head;
204 struct addrinfo *ai_ptr;
205 int sd = -1;
206 int status;
208 /* Check if we already got opened connections */
209 if ((global_read_fh != NULL) && (global_write_fh != NULL))
210 {
211 /* If so, use them */
212 if (ret_read_fh != NULL)
213 *ret_read_fh = global_read_fh;
214 if (ret_write_fh != NULL)
215 *ret_write_fh = global_write_fh;
216 return (0);
217 }
219 /* Get all addrs for this hostname */
220 memset (&ai_hints, 0, sizeof (ai_hints));
221 #ifdef AI_ADDRCONFIG
222 ai_hints.ai_flags |= AI_ADDRCONFIG;
223 #endif
224 ai_hints.ai_family = AF_UNSPEC;
225 ai_hints.ai_socktype = SOCK_STREAM;
227 status = getaddrinfo ((config_host != NULL) ? config_host : DEFAULT_HOST,
228 (config_port != NULL) ? config_port : DEFAULT_PORT,
229 &ai_hints,
230 &ai_head);
231 if (status != 0)
232 {
233 ERROR ("teamspeak2 plugin: getaddrinfo failed: %s",
234 gai_strerror (status));
235 return (-1);
236 }
238 /* Try all given hosts until we can connect to one */
239 for (ai_ptr = ai_head; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next)
240 {
241 /* Create socket */
242 sd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype,
243 ai_ptr->ai_protocol);
244 if (sd < 0)
245 {
246 char errbuf[1024];
247 WARNING ("teamspeak2 plugin: socket failed: %s",
248 sstrerror (errno, errbuf, sizeof (errbuf)));
249 continue;
250 }
252 /* Try to connect */
253 status = connect (sd, ai_ptr->ai_addr, ai_ptr->ai_addrlen);
254 if (status != 0)
255 {
256 char errbuf[1024];
257 WARNING ("teamspeak2 plugin: connect failed: %s",
258 sstrerror (errno, errbuf, sizeof (errbuf)));
259 close (sd);
260 sd = -1;
261 continue;
262 }
264 /*
265 * Success, we can break. Don't need more than one connection
266 */
267 break;
268 } /* for (ai_ptr) */
270 freeaddrinfo (ai_head);
272 /* Check if we really got connected */
273 if (sd < 0)
274 return (-1);
276 /* Create file objects from sockets */
277 global_read_fh = fdopen (sd, "r");
278 if (global_read_fh == NULL)
279 {
280 char errbuf[1024];
281 ERROR ("teamspeak2 plugin: fdopen failed: %s",
282 sstrerror (errno, errbuf, sizeof (errbuf)));
283 close (sd);
284 return (-1);
285 }
287 global_write_fh = fdopen (sd, "w");
288 if (global_write_fh == NULL)
289 {
290 char errbuf[1024];
291 ERROR ("teamspeak2 plugin: fdopen failed: %s",
292 sstrerror (errno, errbuf, sizeof (errbuf)));
293 tss2_close_socket ();
294 return (-1);
295 }
297 { /* Check that the server correctly identifies itself. */
298 char buffer[4096];
299 char *buffer_ptr;
301 buffer_ptr = fgets (buffer, sizeof (buffer), global_read_fh);
302 if (buffer_ptr == NULL)
303 {
304 WARNING ("teamspeak2 plugin: Unexpected EOF received "
305 "from remote host %s:%s.",
306 config_host ? config_host : DEFAULT_HOST,
307 config_port ? config_port : DEFAULT_PORT);
308 }
309 buffer[sizeof (buffer) - 1] = 0;
311 if (memcmp ("[TS]\r\n", buffer, 6) != 0)
312 {
313 ERROR ("teamspeak2 plugin: Unexpected response when connecting "
314 "to server. Expected ``[TS]'', got ``%s''.",
315 buffer);
316 tss2_close_socket ();
317 return (-1);
318 }
319 DEBUG ("teamspeak2 plugin: Server send correct banner, connected!");
320 }
322 /* Copy the new filehandles to the given pointers */
323 if (ret_read_fh != NULL)
324 *ret_read_fh = global_read_fh;
325 if (ret_write_fh != NULL)
326 *ret_write_fh = global_write_fh;
327 return (0);
328 } /* int tss2_get_socket */
330 static int tss2_send_request (FILE *fh, const char *request)
331 {
332 /*
333 * This function puts a request to the server socket
334 */
335 int status;
337 status = fputs (request, fh);
338 if (status < 0)
339 {
340 ERROR ("teamspeak2 plugin: fputs failed.");
341 tss2_close_socket ();
342 return (-1);
343 }
344 fflush (fh);
346 return (0);
347 } /* int tss2_send_request */
349 static int tss2_receive_line (FILE *fh, char *buffer, int buffer_size)
350 {
351 /*
352 * Receive a single line from the given file object
353 */
354 char *temp;
356 /*
357 * fgets is blocking but much easier then doing anything else
358 * TODO: Non-blocking Version would be safer
359 */
360 temp = fgets (buffer, buffer_size, fh);
361 if (temp == NULL)
362 {
363 char errbuf[1024];
364 ERROR ("teamspeak2 plugin: fgets failed: %s",
365 sstrerror (errno, errbuf, sizeof(errbuf)));
366 tss2_close_socket ();
367 return (-1);
368 }
370 buffer[buffer_size - 1] = 0;
371 return (0);
372 } /* int tss2_receive_line */
374 static int tss2_select_vserver (FILE *read_fh, FILE *write_fh, vserver_list_t *vserver)
375 {
376 /*
377 * Tell the server to select the given vserver
378 */
379 char command[128];
380 char response[128];
381 int status;
383 /* Send request */
384 ssnprintf (command, sizeof (command), "sel %i\r\n", vserver->port);
386 status = tss2_send_request (write_fh, command);
387 if (status != 0)
388 {
389 ERROR ("teamspeak2 plugin: tss2_send_request (%s) failed.", command);
390 return (-1);
391 }
393 /* Get answer */
394 status = tss2_receive_line (read_fh, response, sizeof (response));
395 if (status != 0)
396 {
397 ERROR ("teamspeak2 plugin: tss2_receive_line failed.");
398 return (-1);
399 }
400 response[sizeof (response) - 1] = 0;
402 /* Check answer */
403 if ((strncasecmp ("OK", response, 2) == 0)
404 && ((response[2] == 0)
405 || (response[2] == '\n')
406 || (response[2] == '\r')))
407 return (0);
409 ERROR ("teamspeak2 plugin: Command ``%s'' failed. "
410 "Response received from server was: ``%s''.",
411 command, response);
412 return (-1);
413 } /* int tss2_select_vserver */
415 static int tss2_vserver_gapl (FILE *read_fh, FILE *write_fh,
416 gauge_t *ret_value)
417 {
418 /*
419 * Reads the vserver's average packet loss and submits it to collectd.
420 * Be sure to run the tss2_read_vserver function before calling this so
421 * the vserver is selected correctly.
422 */
423 gauge_t packet_loss = NAN;
424 int status;
426 status = tss2_send_request (write_fh, "gapl\r\n");
427 if (status != 0)
428 {
429 ERROR("teamspeak2 plugin: tss2_send_request (gapl) failed.");
430 return (-1);
431 }
433 while (42)
434 {
435 char buffer[4096];
436 char *value;
437 char *endptr = NULL;
439 status = tss2_receive_line (read_fh, buffer, sizeof (buffer));
440 if (status != 0)
441 {
442 /* Set to NULL just to make sure no one uses these FHs anymore. */
443 read_fh = NULL;
444 write_fh = NULL;
445 ERROR ("teamspeak2 plugin: tss2_receive_line failed.");
446 return (-1);
447 }
448 buffer[sizeof (buffer) - 1] = 0;
450 if (strncmp ("average_packet_loss=", buffer,
451 strlen ("average_packet_loss=")) == 0)
452 {
453 /* Got average packet loss, now interpret it */
454 value = &buffer[20];
455 /* Replace , with . */
456 while (*value != 0)
457 {
458 if (*value == ',')
459 {
460 *value = '.';
461 break;
462 }
463 value++;
464 }
466 value = &buffer[20];
468 packet_loss = strtod (value, &endptr);
469 if (value == endptr)
470 {
471 /* Failed */
472 WARNING ("teamspeak2 plugin: Could not read average package "
473 "loss from string: %s", buffer);
474 continue;
475 }
476 }
477 else if (strncasecmp ("OK", buffer, 2) == 0)
478 {
479 break;
480 }
481 else if (strncasecmp ("ERROR", buffer, 5) == 0)
482 {
483 ERROR ("teamspeak2 plugin: Server returned an error: %s", buffer);
484 return (-1);
485 }
486 else
487 {
488 WARNING ("teamspeak2 plugin: Server returned unexpected string: %s",
489 buffer);
490 }
491 }
493 *ret_value = packet_loss;
494 return (0);
495 } /* int tss2_vserver_gapl */
497 static int tss2_read_vserver (vserver_list_t *vserver)
498 {
499 /*
500 * Poll information for the given vserver and submit it to collect.
501 * If vserver is NULL the global server information will be queried.
502 */
503 int status;
505 gauge_t users = NAN;
506 gauge_t channels = NAN;
507 gauge_t servers = NAN;
508 derive_t rx_octets = 0;
509 derive_t tx_octets = 0;
510 derive_t rx_packets = 0;
511 derive_t tx_packets = 0;
512 gauge_t packet_loss = NAN;
513 int valid = 0;
515 char plugin_instance[DATA_MAX_NAME_LEN];
517 FILE *read_fh;
518 FILE *write_fh;
520 /* Get the send/receive sockets */
521 status = tss2_get_socket (&read_fh, &write_fh);
522 if (status != 0)
523 {
524 ERROR ("teamspeak2 plugin: tss2_get_socket failed.");
525 return (-1);
526 }
528 if (vserver == NULL)
529 {
530 /* Request global information */
531 memset (plugin_instance, 0, sizeof (plugin_instance));
533 status = tss2_send_request (write_fh, "gi\r\n");
534 }
535 else
536 {
537 /* Request server information */
538 ssnprintf (plugin_instance, sizeof (plugin_instance), "vserver%i",
539 vserver->port);
541 /* Select the server */
542 status = tss2_select_vserver (read_fh, write_fh, vserver);
543 if (status != 0)
544 return (status);
546 status = tss2_send_request (write_fh, "si\r\n");
547 }
549 if (status != 0)
550 {
551 ERROR ("teamspeak2 plugin: tss2_send_request failed.");
552 return (-1);
553 }
555 /* Loop until break */
556 while (42)
557 {
558 char buffer[4096];
559 char *key;
560 char *value;
561 char *endptr = NULL;
563 /* Read one line of the server's answer */
564 status = tss2_receive_line (read_fh, buffer, sizeof (buffer));
565 if (status != 0)
566 {
567 /* Set to NULL just to make sure no one uses these FHs anymore. */
568 read_fh = NULL;
569 write_fh = NULL;
570 ERROR ("teamspeak2 plugin: tss2_receive_line failed.");
571 break;
572 }
574 if (strncasecmp ("ERROR", buffer, 5) == 0)
575 {
576 ERROR ("teamspeak2 plugin: Server returned an error: %s",
577 buffer);
578 break;
579 }
580 else if (strncasecmp ("OK", buffer, 2) == 0)
581 {
582 break;
583 }
585 /* Split line into key and value */
586 key = strchr (buffer, '_');
587 if (key == NULL)
588 {
589 DEBUG ("teamspeak2 plugin: Cannot parse line: %s", buffer);
590 continue;
591 }
592 key++;
594 /* Evaluate assignment */
595 value = strchr (key, '=');
596 if (value == NULL)
597 {
598 DEBUG ("teamspeak2 plugin: Cannot parse line: %s", buffer);
599 continue;
600 }
601 *value = 0;
602 value++;
604 /* Check for known key and save the given value */
605 /* global info: users_online,
606 * server info: currentusers. */
607 if ((strcmp ("currentusers", key) == 0)
608 || (strcmp ("users_online", key) == 0))
609 {
610 users = strtod (value, &endptr);
611 if (value != endptr)
612 valid |= 0x01;
613 }
614 /* global info: channels,
615 * server info: currentchannels. */
616 else if ((strcmp ("currentchannels", key) == 0)
617 || (strcmp ("channels", key) == 0))
618 {
619 channels = strtod (value, &endptr);
620 if (value != endptr)
621 valid |= 0x40;
622 }
623 /* global only */
624 else if (strcmp ("servers", key) == 0)
625 {
626 servers = strtod (value, &endptr);
627 if (value != endptr)
628 valid |= 0x80;
629 }
630 else if (strcmp ("bytesreceived", key) == 0)
631 {
632 rx_octets = strtoll (value, &endptr, 0);
633 if (value != endptr)
634 valid |= 0x02;
635 }
636 else if (strcmp ("bytessend", key) == 0)
637 {
638 tx_octets = strtoll (value, &endptr, 0);
639 if (value != endptr)
640 valid |= 0x04;
641 }
642 else if (strcmp ("packetsreceived", key) == 0)
643 {
644 rx_packets = strtoll (value, &endptr, 0);
645 if (value != endptr)
646 valid |= 0x08;
647 }
648 else if (strcmp ("packetssend", key) == 0)
649 {
650 tx_packets = strtoll (value, &endptr, 0);
651 if (value != endptr)
652 valid |= 0x10;
653 }
654 else if ((strncmp ("allow_codec_", key, strlen ("allow_codec_")) == 0)
655 || (strncmp ("bwinlast", key, strlen ("bwinlast")) == 0)
656 || (strncmp ("bwoutlast", key, strlen ("bwoutlast")) == 0)
657 || (strncmp ("webpost_", key, strlen ("webpost_")) == 0)
658 || (strcmp ("adminemail", key) == 0)
659 || (strcmp ("clan_server", key) == 0)
660 || (strcmp ("countrynumber", key) == 0)
661 || (strcmp ("id", key) == 0)
662 || (strcmp ("ispname", key) == 0)
663 || (strcmp ("linkurl", key) == 0)
664 || (strcmp ("maxusers", key) == 0)
665 || (strcmp ("name", key) == 0)
666 || (strcmp ("password", key) == 0)
667 || (strcmp ("platform", key) == 0)
668 || (strcmp ("server_platform", key) == 0)
669 || (strcmp ("server_uptime", key) == 0)
670 || (strcmp ("server_version", key) == 0)
671 || (strcmp ("udpport", key) == 0)
672 || (strcmp ("uptime", key) == 0)
673 || (strcmp ("users_maximal", key) == 0)
674 || (strcmp ("welcomemessage", key) == 0))
675 /* ignore */;
676 else
677 {
678 INFO ("teamspeak2 plugin: Unknown key-value-pair: "
679 "key = %s; value = %s;", key, value);
680 }
681 } /* while (42) */
683 /* Collect vserver packet loss rates only if the loop above did not exit
684 * with an error. */
685 if ((status == 0) && (vserver != NULL))
686 {
687 status = tss2_vserver_gapl (read_fh, write_fh, &packet_loss);
688 if (status == 0)
689 {
690 valid |= 0x20;
691 }
692 else
693 {
694 WARNING ("teamspeak2 plugin: Reading package loss "
695 "for vserver %i failed.", vserver->port);
696 }
697 }
699 if ((valid & 0x01) == 0x01)
700 tss2_submit_gauge (plugin_instance, "users", NULL, users);
702 if ((valid & 0x06) == 0x06)
703 tss2_submit_io (plugin_instance, "io_octets", rx_octets, tx_octets);
705 if ((valid & 0x18) == 0x18)
706 tss2_submit_io (plugin_instance, "io_packets", rx_packets, tx_packets);
708 if ((valid & 0x20) == 0x20)
709 tss2_submit_gauge (plugin_instance, "percent", "packet_loss", packet_loss);
711 if ((valid & 0x40) == 0x40)
712 tss2_submit_gauge (plugin_instance, "gauge", "channels", channels);
714 if ((valid & 0x80) == 0x80)
715 tss2_submit_gauge (plugin_instance, "gauge", "servers", servers);
717 if (valid == 0)
718 return (-1);
719 return (0);
720 } /* int tss2_read_vserver */
722 static int tss2_config (const char *key, const char *value)
723 {
724 /*
725 * Interpret configuration values
726 */
727 if (strcasecmp ("Host", key) == 0)
728 {
729 char *temp;
731 temp = strdup (value);
732 if (temp == NULL)
733 {
734 ERROR("teamspeak2 plugin: strdup failed.");
735 return (1);
736 }
737 sfree (config_host);
738 config_host = temp;
739 }
740 else if (strcasecmp ("Port", key) == 0)
741 {
742 char *temp;
744 temp = strdup (value);
745 if (temp == NULL)
746 {
747 ERROR("teamspeak2 plugin: strdup failed.");
748 return (1);
749 }
750 sfree (config_port);
751 config_port = temp;
752 }
753 else if (strcasecmp ("Server", key) == 0)
754 {
755 /* Server variable found */
756 int status;
758 status = tss2_add_vserver (atoi (value));
759 if (status != 0)
760 return (1);
761 }
762 else
763 {
764 /* Unknown variable found */
765 return (-1);
766 }
768 return 0;
769 } /* int tss2_config */
771 static int tss2_read (void)
772 {
773 /*
774 * Poll function which collects global and vserver information
775 * and submits it to collectd
776 */
777 vserver_list_t *vserver;
778 int success = 0;
779 int status;
781 /* Handle global server variables */
782 status = tss2_read_vserver (NULL);
783 if (status == 0)
784 {
785 success++;
786 }
787 else
788 {
789 WARNING ("teamspeak2 plugin: Reading global server variables failed.");
790 }
792 /* Handle vservers */
793 for (vserver = server_list; vserver != NULL; vserver = vserver->next)
794 {
795 status = tss2_read_vserver (vserver);
796 if (status == 0)
797 {
798 success++;
799 }
800 else
801 {
802 WARNING ("teamspeak2 plugin: Reading statistics "
803 "for vserver %i failed.", vserver->port);
804 continue;
805 }
806 }
808 if (success == 0)
809 return (-1);
810 return (0);
811 } /* int tss2_read */
813 static int tss2_shutdown(void)
814 {
815 /*
816 * Shutdown handler
817 */
818 vserver_list_t *entry;
820 tss2_close_socket ();
822 entry = server_list;
823 server_list = NULL;
824 while (entry != NULL)
825 {
826 vserver_list_t *next;
828 next = entry->next;
829 sfree (entry);
830 entry = next;
831 }
833 /* Get rid of the configuration */
834 sfree (config_host);
835 sfree (config_port);
837 return (0);
838 } /* int tss2_shutdown */
840 void module_register(void)
841 {
842 /*
843 * Mandatory module_register function
844 */
845 plugin_register_config ("teamspeak2", tss2_config,
846 config_keys, config_keys_num);
847 plugin_register_read ("teamspeak2", tss2_read);
848 plugin_register_shutdown ("teamspeak2", tss2_shutdown);
849 } /* void module_register */
851 /* vim: set sw=4 ts=4 : */