annotate dpid/dpi.h @ 0:6ee11bf9e3ea

Initial revision
author jcid
date Sun, 07 Oct 2007 00:36:34 +0200
parents
children a09dbf132be6
rev   line source
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1 /*! \file
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
2 * Access functions for ~/.dillo/dpi_socket_dir.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
3 * The most useful function for dillo is a_Dpi_srs, it returns
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
4 * the full path to the dpid service request socket.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
5 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
6
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
7 #ifndef DPI_H
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
8 #define DPI_H
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
9
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
10 #include <config.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
11 #include <stdio.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
12 #include <sys/types.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
13 #include <sys/stat.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
14 #include <unistd.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
15 #include <stdlib.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
16 #include <string.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
17
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
18 /* Check the Unix98 goodie */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
19 #ifndef socklen_t
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
20 #define socklen_t uint32_t
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
21 #endif
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
22
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
23 /* Some systems may not have this one... */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
24 #ifndef AF_LOCAL
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
25 #define AF_LOCAL AF_UNIX
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
26 #endif
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
27
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
28 /* This one is tricky, some sources state it should include the byte
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
29 * for the terminating NULL, and others say it shouldn't.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
30 * The other way is to only use this one when a native SUN_LEN is not present,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
31 * but as dillo has used this for a long time successfully, here it goes.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
32 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
33 # define D_SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
34 + strlen ((ptr)->sun_path))
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
35
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
36 /*!
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
37 * dpi commands
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
38 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
39 enum {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
40 UNKNOWN_CMD,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
41 BYE_CMD, /* "DpiBye" */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
42 CHECK_SERVER_CMD, /* "check_server" */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
43 REGISTER_ALL_CMD, /* "register_all" */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
44 REGISTER_SERVICE_CMD /* "register_service" */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
45 };
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
46
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
47
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
48 char *a_Dpi_sockdir_file(void);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
49
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
50 char *a_Dpi_rd_dpi_socket_dir(char *dirname);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
51
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
52 char *a_Dpi_srs(void);
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
53
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
54 #endif