|
@@ -37,6 +37,8 @@
|
|
|
#include <vcc/vcc.h>
|
|
#include <vcc/vcc.h>
|
|
|
#include <vcc/version.h>
|
|
#include <vcc/version.h>
|
|
|
|
|
|
|
|
|
|
+#define clear_req(req) memset(req, 0, REQ_SIZE)
|
|
|
|
|
+
|
|
|
|
|
|
|
|
extern int fd;
|
|
extern int fd;
|
|
|
|
|
|
|
@@ -47,6 +49,8 @@ int do_cmd_ls_bh(struct vcc_request *);
|
|
|
int send_msg(const char *msg, const char *usrname) {
|
|
int send_msg(const char *msg, const char *usrname) {
|
|
|
struct vcc_request req;
|
|
struct vcc_request req;
|
|
|
|
|
|
|
|
|
|
+ clear_req(&req);
|
|
|
|
|
+
|
|
|
req.magic = htonl(VCC_MAGIC);
|
|
req.magic = htonl(VCC_MAGIC);
|
|
|
req.reqtype = htonl(REQ_MSG_SEND);
|
|
req.reqtype = htonl(REQ_MSG_SEND);
|
|
|
req.uid = 0;
|
|
req.uid = 0;
|
|
@@ -62,7 +66,7 @@ int send_msg(const char *msg, const char *usrname) {
|
|
|
int get_msgs(void) {
|
|
int get_msgs(void) {
|
|
|
struct vcc_request req;
|
|
struct vcc_request req;
|
|
|
|
|
|
|
|
- memset(&req, 0, REQ_SIZE);
|
|
|
|
|
|
|
+ clear_req(&req);
|
|
|
|
|
|
|
|
req.magic = htonl(VCC_MAGIC);
|
|
req.magic = htonl(VCC_MAGIC);
|
|
|
req.reqtype = htonl(REQ_MSG_NEW);
|
|
req.reqtype = htonl(REQ_MSG_NEW);
|
|
@@ -82,6 +86,8 @@ int read_msg(struct vcc_request *buf) {
|
|
|
int get_users(void) {
|
|
int get_users(void) {
|
|
|
struct vcc_request req;
|
|
struct vcc_request req;
|
|
|
|
|
|
|
|
|
|
+ clear_req(&req);
|
|
|
|
|
+
|
|
|
req.magic = htonl(VCC_MAGIC);
|
|
req.magic = htonl(VCC_MAGIC);
|
|
|
req.reqtype = htonl(REQ_CTL_USRS);
|
|
req.reqtype = htonl(REQ_CTL_USRS);
|
|
|
req.uid = 0;
|
|
req.uid = 0;
|
|
@@ -117,6 +123,8 @@ int do_bh(struct vcc_request *req) {
|
|
|
int vcc_login(char *usrname, char *passwd) {
|
|
int vcc_login(char *usrname, char *passwd) {
|
|
|
struct vcc_request req;
|
|
struct vcc_request req;
|
|
|
|
|
|
|
|
|
|
+ clear_req(&req);
|
|
|
|
|
+
|
|
|
req.magic = htonl(VCC_MAGIC);
|
|
req.magic = htonl(VCC_MAGIC);
|
|
|
req.reqtype = htonl(REQ_CTL_LOGIN);
|
|
req.reqtype = htonl(REQ_CTL_LOGIN);
|
|
|
|
|
|