diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2006-10-31 13:17:39 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2006-10-31 13:17:39 +0100 |
commit | fe8fb00dd57714528535de7e3a8d42f64e7a79aa (patch) | |
tree | e8642fbc016b084f6db00950bfb4e6e0d8da784d /nslcd-client.h | |
parent | 93bda65a159e1f03b934fcb7050a5e1fba9bb2b7 (diff) |
clear up protocol macros while implementing getpwuid() and {set,get,end}pwent() functions (last not yet on NSS side)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/libnss_ldapd@34 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd-client.h')
-rw-r--r-- | nslcd-client.h | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/nslcd-client.h b/nslcd-client.h index 1e5d46d..ca9273b 100644 --- a/nslcd-client.h +++ b/nslcd-client.h @@ -26,18 +26,32 @@ #include <stdio.h> #include "nslcd.h" - -/* Extra request results. */ -#define NSLCD_RS_SMALLBUF 100 /* buffer too small */ +#include "nslcd-common.h" /* returns a socket to the server or NULL on error (see errno), socket should be closed with fclose() */ FILE *nslcd_client_open(void); -/* write a request message, returns <0 in case of errors */ -int nslcd_client_writerequest(FILE *fp,int type,const char *name,size_t count); - -/* read a response message, return a NSLCD_RS_* status */ -int nslcd_client_readresponse(FILE *fp,int type); +/* open a client socket */ +#define OPEN_SOCK(fp) \ + if ((fp=nslcd_client_open())==NULL) \ + { ERROR_OUT_OPENERROR } + +#define WRITE_REQUEST(fp,req) \ + WRITE_INT32(fp,NSLCD_VERSION) \ + WRITE_INT32(fp,req) + +#define READ_RESPONSEHEADER(fp,req) \ + READ_TYPE(fp,tmpint32,int32_t); \ + if (tmpint32!=NSLCD_VERSION) \ + { ERROR_OUT_READERROR(fp) } \ + READ_TYPE(fp,tmpint32,int32_t); \ + if (tmpint32!=(req)) \ + { ERROR_OUT_READERROR(fp) } + +#define READ_RESPONSE(fp) \ + READ_TYPE(fp,tmpint32,int32_t); \ + if (tmpint32!=NSLCD_RS_SUCCESS) \ + { ERROR_OUT_NOSUCCESS(fp,tmpint32) } #endif /* not _NSLCD_CLIENT_H */ |