/home/dko/projects/mobilec/trunk/src/include/fipa_acl.h

Go to the documentation of this file.
00001 /* SVN FILE INFO
00002  * $Revision: 200 $ : Last Committed Revision
00003  * $Date: 2008年07月11日 11:45:41 -0700 (2008年7月11日) $ : Last Committed Date */
00004 /*[
00005  * Copyright (c) 2007 Integration Engineering Laboratory
00006  University of California, Davis
00007  *
00008  * Permission to use, copy, and distribute this software and its
00009  * documentation for any purpose with or without fee is hereby granted,
00010  * provided that the above copyright notice appear in all copies and
00011  * that both that copyright notice and this permission notice appear
00012  * in supporting documentation.
00013  *
00014  * Permission to modify the software is granted, but not the right to
00015  * distribute the complete modified source code. Modifications are to
00016  * be distributed as patches to the released version. Permission to
00017  * distribute binaries produced by compiling modified sources is granted,
00018  * provided you
00019  * 1. distribute the corresponding source modifications from the
00020  * released version in the form of a patch file along with the binaries,
00021  * 2. add special version identification to distinguish your version
00022  * in addition to the base release version number,
00023  * 3. provide your name and address as the primary contact for the
00024  * support of your modified version, and
00025  * 4. retain our contact information in regard to use of the base
00026  * software.
00027  * Permission to distribute the released version of the source code along
00028  * with corresponding source modifications in the form of a patch file is
00029  * granted with same provisions 2 through 4 for binary distributions.
00030  *
00031  * This software is provided "as is" without express or implied warranty
00032  * to the extent permitted by applicable law.
00033 ]*/
00034 
00035 #ifndef _FIPA_ACL_MESSAGE_H_
00036 #define _FIPA_ACL_MESSAGE_H_
00037 #include "dynstring.h"
00038 
00039 #ifndef _FIPA_PERFORMATIVE_E_
00040 #define _FIPA_PERFORMATIVE_E_
00041 enum fipa_performative_e
00042 {
00043 FIPA_ERROR=-1,
00044 FIPA_ZERO,
00045 FIPA_ACCEPT_PROPOSAL,
00046 FIPA_AGREE,
00047 FIPA_CANCEL,
00048 FIPA_CALL_FOR_PROPOSAL,
00049 FIPA_CONFIRM,
00050 FIPA_DISCONFIRM,
00051 FIPA_FAILURE,
00052 FIPA_INFORM,
00053 FIPA_INFORM_IF,
00054 FIPA_INFORM_REF,
00055 FIPA_NOT_UNDERSTOOD,
00056 FIPA_PROPOGATE,
00057 FIPA_PROPOSE,
00058 FIPA_PROXY,
00059 FIPA_QUERY_IF,
00060 FIPA_QUERY_REF,
00061 FIPA_REFUSE,
00062 FIPA_REJECT_PROPOSAL,
00063 FIPA_REQUEST,
00064 FIPA_REQUEST_WHEN,
00065 FIPA_REQUEST_WHENEVER,
00066 FIPA_SUBSCRIBE
00067 };
00068 #endif
00069 
00070 int fipa_performative_Compose(dynstring_t* msg, enum fipa_performative_e performative);
00071 
00072 typedef enum fipa_expression_type_e
00073 {
00074 FIPA_EXPR_ZERO,
00075 FIPA_EXPR_WORD,
00076 FIPA_EXPR_STRING,
00077 FIPA_EXPR_NUMBER,
00078 FIPA_EXPR_DATETIME,
00079 FIPA_EXPR_EXPRESSION
00080 } fipa_expression_type_t; 
00081 
00082 /* fipa_acl_message */
00083 typedef struct fipa_acl_message_s
00084 {
00085 enum fipa_performative_e performative;
00086 
00087 struct fipa_agent_identifier_s* sender;
00088 
00089 struct fipa_agent_identifier_set_s* receiver;
00090 int receiver_num;
00091 
00092 struct fipa_agent_identifier_set_s* reply_to;
00093 
00094 /*struct fipa_content_s* content; */
00095 struct fipa_string_s* content; /* We will write the parser for this later */
00096 
00097 struct fipa_expression_s* language;
00098 
00099 struct fipa_expression_s* encoding;
00100 
00101 struct fipa_expression_s* ontology;
00102 
00103 struct fipa_word_s* protocol;
00104 
00105 struct fipa_expression_s* conversation_id;
00106 
00107 struct fipa_expression_s* reply_with;
00108 
00109 struct fipa_expression_s* in_reply_to;
00110 
00111 struct fipa_DateTime_s* reply_by;
00112 } fipa_acl_message_t;
00113 typedef fipa_acl_message_t* fipa_acl_message_p;
00114 fipa_acl_message_t* fipa_acl_message_New(void);
00115 int fipa_acl_message_Destroy(fipa_acl_message_t* message);
00116 fipa_acl_message_t* fipa_acl_message_Copy(fipa_acl_message_t* src);
00117 int fipa_acl_Compose(dynstring_t** msg, fipa_acl_message_t* acl);
00118 
00119 /* fipa_message_string */
00120 typedef struct fipa_message_string_s
00121 {
00122 char* message;
00123 char* parse; /* This pointer points to some part of "message" */
00124 } fipa_message_string_t;
00125 typedef fipa_message_string_t* fipa_message_string_p;
00126 fipa_message_string_t* fipa_message_string_New(void);
00127 int fipa_message_string_Destroy(fipa_message_string_t* message);
00128 fipa_message_string_t* fipa_message_string_Copy(fipa_message_string_t* src);
00129 
00130 /* fipa_url_sequence */
00131 typedef struct fipa_url_sequence_s
00132 {
00133 int num;
00134 struct fipa_url_s** urls;
00135 } fipa_url_sequence_t;
00136 typedef fipa_url_sequence_t* fipa_url_sequence_p;
00137 fipa_url_sequence_t* fipa_url_sequence_New(void);
00138 int fipa_url_sequence_Destroy(fipa_url_sequence_t* sequence);
00139 fipa_url_sequence_t* fipa_url_sequence_Copy(fipa_url_sequence_t* src);
00140 int fipa_url_sequence_Compose(dynstring_t* msg, fipa_url_sequence_t* urls);
00141 
00142 /* fipa_agent_identifier_set */
00143 typedef struct fipa_agent_identifier_set_s
00144 {
00145 int num;
00146 int retain_order;
00147 struct fipa_agent_identifier_s** fipa_agent_identifiers;
00148 } fipa_agent_identifier_set_t;
00149 typedef fipa_agent_identifier_set_t* fipa_agent_identifier_set_p;
00150 fipa_agent_identifier_set_t* fipa_agent_identifier_set_New(void);
00151 int fipa_agent_identifier_set_Destroy(fipa_agent_identifier_set_t* idset);
00152 fipa_agent_identifier_set_t* fipa_agent_identifier_set_Copy(
00153 fipa_agent_identifier_set_t* src);
00154 int fipa_agent_identifier_set_Compose(dynstring_t* msg, fipa_agent_identifier_set_t* ids);
00155 
00156 /* fipa_agent_identifier */
00157 typedef struct fipa_agent_identifier_s
00158 {
00159 char* name;
00160 struct fipa_url_sequence_s* addresses;
00161 struct fipa_agent_identifier_set_s* resolvers;
00162 } fipa_agent_identifier_t;
00163 typedef fipa_agent_identifier_t* fipa_agent_identifier_p;
00164 fipa_agent_identifier_t* fipa_agent_identifier_New(void);
00165 int fipa_agent_identifier_Destroy(fipa_agent_identifier_t* id);
00166 fipa_agent_identifier_t* fipa_agent_identifier_Copy(fipa_agent_identifier_t* src);
00167 int fipa_agent_identifier_Compose(dynstring_t* msg, fipa_agent_identifier_t* id);
00168 
00169 /* fipa_expression */
00170 typedef struct fipa_expression_s
00171 {
00172 enum fipa_expression_type_e type;
00173 union content_u
00174 {
00175 struct fipa_word_s* word;
00176 struct fipa_string_s* string;
00177 struct fipa_number_s* number;
00178 struct fipa_DateTime_s* datetime;
00179 struct fipa_expression_s** expression;
00180 } content;
00181 } fipa_expression_t;
00182 typedef fipa_expression_t* fipa_expression_p;
00183 fipa_expression_t* fipa_expression_New(void);
00184 int fipa_expression_Destroy(fipa_expression_t* expr);
00185 fipa_expression_t* fipa_expression_Copy(fipa_expression_t* src);
00186 int fipa_expression_Compose(dynstring_t* msg, fipa_expression_t* expr);
00187 
00188 /* fipa_word */
00189 typedef struct fipa_word_s
00190 {
00191 char* content;
00192 } fipa_word_t;
00193 typedef fipa_word_t* fipa_word_p;
00194 fipa_word_t* fipa_word_New(void);
00195 int fipa_word_Destroy(fipa_word_t* word);
00196 fipa_word_t* fipa_word_Copy(fipa_word_t* src);
00197 int fipa_word_Compose(dynstring_t* msg, fipa_word_t* word);
00198 
00199 /* fipa_string */
00200 typedef struct fipa_string_s
00201 {
00202 char* content;
00203 } fipa_string_t;
00204 typedef fipa_string_t* fipa_string_p;
00205 fipa_string_t* fipa_string_New(void);
00206 int fipa_string_Destroy(fipa_string_t* str);
00207 fipa_string_t* fipa_string_Copy(fipa_string_t* src);
00208 int fipa_string_Compose(dynstring_t* msg, fipa_string_t* string);
00209 
00210 /* fipa_DateTime */
00211 typedef struct fipa_DateTime_s
00212 {
00213 int year;
00214 int month;
00215 int day;
00216 int hour;
00217 int minute;
00218 int second;
00219 int millisecond;
00220 char sign; /* May be '+', '-', or '0円' */
00221 int is_utc; /* May be 1 (yes) or 0 (no) */
00222 } fipa_DateTime_t;
00223 typedef fipa_DateTime_t* fipa_DateTime_p;
00224 fipa_DateTime_t* fipa_DateTime_New(void);
00225 int fipa_DateTime_Destroy(fipa_DateTime_t* dt);
00226 fipa_DateTime_t* fipa_DateTime_Copy(fipa_DateTime_t* src);
00227 int fipa_DateTime_Compose(dynstring_t* msg, fipa_DateTime_t* date);
00228 
00229 /* fipa_url */
00230 typedef struct fipa_url_s
00231 {
00232 char *str;
00233 } fipa_url_t;
00234 typedef fipa_url_t* fipa_url_p;
00235 fipa_url_t* fipa_url_New(void);
00236 int fipa_url_Destroy(fipa_url_t* url);
00237 fipa_url_t* fipa_url_Copy(fipa_url_t* src);
00238 int fipa_url_Compose(dynstring_t* msg, fipa_url_t* url);
00239 
00240 /* fipa_Number */
00241 typedef struct fipa_number_s
00242 {
00243 char *str;
00244 } fipa_number_t;
00245 typedef fipa_number_t* fipa_number_p;
00246 fipa_number_t* fipa_number_New(void);
00247 int fipa_number_Destroy(fipa_number_t* number);
00248 fipa_number_t* fipa_number_Copy(fipa_number_t* src);
00249 int fipa_number_Compose(dynstring_t* msg, fipa_number_t* number);
00250 
00251 
00252 /* Parsing Functions */
00253 int fipa_acl_Parse(struct fipa_acl_message_s* acl, fipa_message_string_p message);
00254 int fipa_message_parameter_Parse(struct fipa_acl_message_s* acl, fipa_message_string_p message);
00255 int fipa_message_type_Parse(
00256 enum fipa_performative_e* performative, 
00257 fipa_message_string_p message
00258 );
00259 int fipa_GetAtom(
00260 fipa_message_string_p message,
00261 char expected_atom
00262 );
00263 int fipa_word_Parse(fipa_word_t** word, fipa_message_string_p message);
00264 int fipa_word_Destroy(fipa_word_t* word);
00265 int fipa_CheckNextToken(const fipa_message_string_p message, const char* token);
00266 int fipa_expression_Parse(fipa_expression_t** expression, fipa_message_string_p message);
00267 int fipa_GetNextWord(char** word, const fipa_message_string_p message);
00268 int fipa_GetWholeToken(char** word, const fipa_message_string_p message);
00269 int fipa_datetime_Parse(fipa_DateTime_p* datetime, fipa_message_string_p message);
00270 int fipa_string_Parse( fipa_string_p* fipa_string, fipa_message_string_p message);
00271 int fipa_agent_identifier_Parse(fipa_agent_identifier_p* aid, fipa_message_string_p message);
00272 int fipa_agent_identifier_set_Parse(fipa_agent_identifier_set_p* agent_ids, fipa_message_string_p message);
00273 int fipa_url_sequence_Parse(fipa_url_sequence_p* urls, fipa_message_string_p message);
00274 int fipa_url_Parse(fipa_url_p* url, fipa_message_string_p message);
00275 
00276 struct fipa_acl_message_s* fipa_Reply(
00277 struct fipa_acl_message_s* acl);
00278 
00279 #endif

Generated on Tue Oct 28 17:03:22 2008 for Mobile-C by doxygen 1.5.5

AltStyle によって変換されたページ (->オリジナル) /