xsecurelock  1.7.0
XSecureLock is an X11 screen lock utility.
authproto.h
Go to the documentation of this file.
1 /*
2 Copyright 2014 Google Inc. All rights reserved.
3 
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16 
17 #ifndef AUTHPROTO_H
18 #define AUTHPROTO_H
19 
20 // Packet format:
21 //
22 // <ptype> <SPC> <len> <NEWLINE> <message> <NEWLINE>
23 //
24 // where
25 //
26 // ptype = one of the below characters.
27 // len = message length encoded in decimal ASCII.
28 // message = len bytes that shall be shown to the user.
29 //
30 // By convention, uppercase packet types expect a reply and lowercase packet
31 // types are "terminal".
32 
33 // PAM-to-user messages:
34 #define PTYPE_INFO_MESSAGE 'i'
35 #define PTYPE_ERROR_MESSAGE 'e'
36 #define PTYPE_PROMPT_LIKE_USERNAME 'U'
37 #define PTYPE_PROMPT_LIKE_PASSWORD 'P'
38 // Note: there's no specific message type for successful authentication or
39 // similar; the caller shall use the exit status of the helper only.
40 
41 // User-to-PAM messages:
42 #define PTYPE_RESPONSE_LIKE_USERNAME 'u'
43 #define PTYPE_RESPONSE_LIKE_PASSWORD 'p'
44 #define PTYPE_RESPONSE_CANCELLED 'x'
45 
53 void WritePacket(int fd, char type, const char *message);
54 
65 char ReadPacket(int fd, char **message, int eof_permitted);
66 
67 #endif
char ReadPacket(int fd, char **message, int eof_permitted)
Reads a packet in above form.
Definition: authproto.c:102
void WritePacket(int fd, char type, const char *message)
Writes a packet in above form.
Definition: authproto.c:49