/home/dko/projects/mobilec/trunk/src/win32/LibMC.net/LibMC/MCAclMessage.cs

Go to the documentation of this file.
00001 using System;
00002 using System.Collections.Generic;
00003 using System.Text;
00004 
00063 namespace LibMC
00064 {
00072     public class MCAclMessage
00073     {
00079         public enum MC_FipaPerformative_e
00080         {
00081             FIPA_ERROR = -1,            
00082             FIPA_ZERO,                  
00083             FIPA_ACCEPT_PROPOSAL,       
00084             FIPA_AGREE,                 
00085             FIPA_CANCEL,                
00086             FIPA_CALL_FOR_PROPOSAL,     
00087             FIPA_CONFIRM,               
00088             FIPA_DISCONFIRM,            
00089             FIPA_FAILURE,               
00090             FIPA_INFORM,                
00091             FIPA_INFORM_IF,             
00092             FIPA_INFORM_REF,            
00093             FIPA_NOT_UNDERSTOOD,        
00094             FIPA_PROPOGATE,             
00095             FIPA_PROPOSE,               
00096             FIPA_PROXY,                 
00097             FIPA_QUERY_IF,              
00098             FIPA_QUERY_REF,             
00099             FIPA_REFUSE,                
00100             FIPA_REJECT_PROPOSAL,       
00101             FIPA_REQUEST,               
00102             FIPA_REQUEST_WHEN,          
00103             FIPA_REQUEST_WHENEVER,      
00104             FIPA_SUBSCRIBE              
00105         };
00106 
00107         private IntPtr aclmsg_p;
00108 
00114         public MCAclMessage()
00115         {
00116             // NOT using accessor!
00117             aclmsg_p = IntPtr.Zero;
00118         }
00119 
00120         internal MCAclMessage(IntPtr msg)
00121         {
00122             AclMsg = msg;
00123         }
00124         
00125         /*
00126          * Accessors
00127          */
00128         internal IntPtr AclMsg
00129         {
00130             get
00131             {
00132                 if (aclmsg_p == IntPtr.Zero)
00133                     throw new SystemException("Private acl message pointer is zero!");
00134                 else
00135                     return aclmsg_p;
00136             }
00137             set
00138             {
00139                 if (aclmsg_p == IntPtr.Zero)
00140                 {
00141                     aclmsg_p = value;
00142                 }
00143                 else
00144                     throw new SystemException("Attempting to assign new acl message to non-zero acl message pointer!");
00145             }
00146         }
00147 
00153         public void New()
00154         {
00155             AclMsg = MCAgency._MC_AclNew();
00156         }
00157 
00167         public MCAclMessage Reply(MCAclMessage acl_message)
00168         {
00169             IntPtr temp = MCAgency._MC_AclReply(acl_message.AclMsg);
00170             if (temp == IntPtr.Zero)
00171                 return new MCAclMessage();
00172             else
00173                 return new MCAclMessage(temp);
00174         }
00175 
00186         public int SetPerformative(MC_FipaPerformative_e performative)
00187         {
00188             return MCAgency._MC_AclSetPerformative(AclMsg, performative);
00189         }
00190 
00202         public int SetSender(String name, String address)
00203         {
00204             return MCAgency._MC_AclSetSender(AclMsg, name, address);
00205         }
00206 
00218         public int AddReceiver(String name, String address)
00219         {
00220             return MCAgency._MC_AclAddReceiver(AclMsg, name, address);
00221         }
00222 
00235         public int AddReplyTo(String name, String address)
00236         {
00237             return MCAgency._MC_AclAddReplyTo(AclMsg, name, address);
00238         }
00239 
00250         public int SetContent(String content)
00251         {
00252             return MCAgency._MC_AclSetContent(AclMsg, content);
00253         }
00254 
00269         public int Destroy()
00270         {
00271             int temp = MCAgency._MC_AclDestroy(AclMsg);
00272             if (temp == 0)
00273                 aclmsg_p = IntPtr.Zero;
00274             return temp;
00275         }
00276 
00277     }
00278 }

Generated on Mon Jun 23 16:01:12 2008 for Mobile-C by  doxygen 1.5.4