]> rtime.felk.cvut.cz Git - frescor/fwp.git/commitdiff
Fixes in fwp_contract - small msgb for both response
authorMartin Molnar <molnam1@fel.cvut.cz>
Tue, 19 Feb 2008 01:27:22 +0000 (02:27 +0100)
committerMartin Molnar <molnam1@fel.cvut.cz>
Tue, 19 Feb 2008 01:27:22 +0000 (02:27 +0100)
fwp/lib/fwp_contract.c
fwp/lib/fwp_proto.h
fwp/mngt/fwp_agent.c
fwp/mngt/fwp_mngr.c
fwp/tests/fwp_mngrtest/fwp_mngrtest.c

index d6c76ce2420754e193475b549f347de4a771c463..058eb3aeaf18e6c21d1fb8700bd01320f8076373 100644 (file)
@@ -32,7 +32,7 @@ int fwp_contract_negotiate(struct fwp_contract *contract, int *vres_id)
        ssize_t len;
 
        msgb = fwp_msgb_alloc(sizeof(struct fwp_msg_header) + 
-                             sizeof(struct fwp_msg_contract));
+                             sizeof(struct fwp_msg_vres_params)/*FWP_MTU*/);
        
        if (!msgb) 
                return -ENOMEM;
@@ -61,7 +61,7 @@ int fwp_contract_negotiate(struct fwp_contract *contract, int *vres_id)
        fwp_msgb_pull(msgb, sizeof(struct fwp_msg_vres_params));
 
        fwp_msgb_free(msgb);
-       
+       FWP_DEBUG("status = %d\n", status);     
        if (status == FWP_CONT_NEGOTIATED) {
                FWP_DEBUG("Contract negotiated\n");
                if ((rc = fwp_vres_open(&vparams)) < 0){
index aa269b2ccd19c53292e16ef48d90f5f06acd0714..73c8e8e032fcc39ac1583df5103ccdfaa6ec4fdd 100644 (file)
@@ -4,6 +4,7 @@
 #include "fwp_util.h"
 #include "fwp_msgq.h"
 #include "fwp_msg.h"
+#include "fwp_contract.h"
 #include "fwp_vres.h"
 
 
index da1c812756a412f81dcc421082b91382c9721b85..eb4fa204e6206086752c48c42d196d5dd2298604 100644 (file)
@@ -174,14 +174,18 @@ int fwp_agent_contnegt_response(struct fwp_msgb *msgb, unsigned int hid)
 {
        fwp_handshake_t *handshake;     
        struct sockaddr_un *unsock;
-               
+       fwp_contract_status_t status;
+       fwp_vres_params_t vparams;
+
        handshake = hashtbl_get(&handshake_tbl, hid);
        if (!handshake) {
                return -EINVAL;
        } 
                
+       fwp_msg_vres_params_inflate(msgb->data, &status, &vparams);
        fwp_msgb_push(msgb, sizeof(struct fwp_msg_header));
        
+       FWP_DEBUG("status = %d\n", status);     
        FWP_DEBUG("hid = %d\n", hid);   
        FWP_DEBUG("id = %d\n", handshake->id);  
        FWP_DEBUG("len = %d\n", handshake->peer.addrlen);       
index f955eefce609eef2f20fcc8926cae37ee099a8b2..64923e94c71b96c4d0ba12755438e7ebdf277605 100644 (file)
@@ -199,7 +199,7 @@ int fwp_mngr_contnegt_response(unsigned int hid, fwp_contract_data_t *contdata)
        msgb->peer = &contdata->source;
        /* add sending to local app through unix socket */
        fwp_vres_send(service_vres_id, msgb);
-
+       FWP_DEBUG("len = %d", msgb->len);
        return 0;
 }
 
index c0e5dc224e9fef535416c883a57734f76659e2ce..a5ded257f34990188dca6fe343fe1c032c36b4ac 100644 (file)
@@ -20,13 +20,13 @@ int main()
        fwp_init();
        
        rc = fwp_contract_negotiate(&cnt1, &vres_id);
-       if (rc == FWP_CONT_NEGOTIATED) {
+       if (rc == FWP_CONTNEGT_ACCEPTED) {
                printf("Contract 1 negotiated\n");
        } else 
                printf("Contract 1 rejected.\n");
        
        rc = fwp_contract_negotiate(&cnt2, &vres_id);
-       if (rc == FWP_CONT_NEGOTIATED) {
+       if (rc == FWP_CONTNEGT_ACCEPTED) {
                printf("Contract 2 negotiated\n");
        } else 
                printf("Contract 2  rejected.\n");