]> rtime.felk.cvut.cz Git - frescor/fwp.git/blobdiff - fwp/lib/mngt/fwp_contract.h
Added support for contract negotiation
[frescor/fwp.git] / fwp / lib / mngt / fwp_contract.h
index 7f499f64f918a0fe2d56e34658aef1f320f591de..bdf48c059b87519a3de2ef6d3075561a80fd2ecd 100644 (file)
@@ -30,6 +30,7 @@ typedef
 struct fwp_contract {
        int budget;             /**< bytes per period */
        int period_usec;        /**< all time units are in microseconds */
+       int deadline_usec;
 } fwp_contract_t;
 
 struct fwp_contract_data;
@@ -68,34 +69,35 @@ typedef fwp_vres_id_t fwp_contract_id_t;
 
 /**
  * FWP contract.
- * It is an internal representation of contract.
- * 
+ * This is an internal representation of contract in every FWP application.
  */
 struct fwp_contract_data {
        fwp_contract_id_t               id;     
-       /**< contract specified by user */
+       /** contract specified by user */
        fwp_contract_t                  contract;
-       /**< parameters from contract negotiated for vres */
+       /** parameters from contract negotiated for vres */
        fwp_vres_params_t               vres_params;
-       /**< the address of agent from that the contract comes */
+       /* * the address of agent from that the contract comes */
        /*fwp_transaction_id_t          trans_id;*/     
        /* pointer to fwp_vres or fwp_participant */
        /*void                          *priv; */
        fwp_vres_d_t                    vresd;
        fwp_contract_status_t           status;
-       /**< For future: exclude (replaced) contract 
+       /** For future: exclude (replaced) contract 
        fwp_contract_d_t                contex; */
 
        ul_list_node_t                  list_node;
        gavl_node_t                     tree_node;      
-        /* owner,
-        *  acls*/
+       /* owner,
+        * acls*/
 };
 
 static inline fwp_contract_data_t* fwp_contract_data_new()
 {
-       return memset(malloc(sizeof (fwp_contract_data_t)),'\0', 
-                       sizeof(fwp_contract_data_t));
+       fwp_contract_data_t *contdata = malloc(sizeof (fwp_contract_data_t));
+       if (!contdata)
+               return NULL;
+       return memset(contdata,'\0', sizeof(fwp_contract_data_t));
 }
 
 static inline void fwp_contract_data_delete(fwp_contract_data_t* contdata)