Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd.h
blob: 42d767653858b90a11ec9f2ab0fa2f6fc871caf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
   nslcd.h - file describing client/server protocol 

   Copyright (C) 2006 West Consulting
   Copyright (C) 2006 Arthur de Jong

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with this library; if not, write to the Free
   Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
   MA 02110-1301 USA
*/

#ifndef _NSLCD_H
#define _NSLCD_H 1

/*
   A request messages basically looks like:
     int32 NSLCD_VERSION
     int32 NSLCD_RT_*
     int32 length(name)
     ...   name
     int32 NSLCD_MAGIC
   (any messages not fitting this should be ignored
    closing the connection)
   A response looks like:
     int32 NSLCD_VERSION
     int32 NSLCD_RT_* (the original request type)
     int32 length(result)
     ... result
     int32 NSLCD_MAGIC
*/

/* TODO: generate this file from a .in file */

/* The location of the socket used for communicating. */
#define NSLCD_SOCKET "/tmp/nslcd.socket"

/* The location of the pidfile used for checking availability of the nslcd. */
#define NSLCD_PIDFILE "/tmp/nslcd.pid"

/* The current version of the protocol. */
#define NSLCD_VERSION 1

/* The magic number passed back and forth. This is to reducte the change of
   handling non-valid requests (e.g. some random data). */
#define NSLCD_MAGIC 0x8642

/* Request types. */
#define NSLCD_RT_GETPWBYNAME  	    	1
#define NSLCD_RT_GETPWBYUID		2
#define NSLCD_RT_GETGRBYNAME		3
#define NSLCD_RT_GETGRBYGID		4
#define NSLCD_RT_GETHOSTBYNAME		5
#define NSLCD_RT_GETHOSTBYNAMEv6	7
#define NSLCD_RT_GETHOSTBYADDR		8
#define NSLCD_RT_GETHOSTBYADDRv6	9
#define NSLCD_RT_LASTDBREQ           	NSLCD_RT_GETHOSTBYADDRv6

/* Request result. */
#define NSLCD_RS_TRYAGAIN               1
#define NSLCD_RS_UNAVAIL                2
#define NSLCD_RS_NOTFOUND               3
#define NSLCD_RS_SUCCESS                0
#define NSLCD_RS_RETURN                 4

#endif /* not _NSLCD_H */