dtn_api.h

Go to the documentation of this file.
00001 /*
00002  *    Copyright 2004-2006 Intel Corporation
00003  * 
00004  *    Licensed under the Apache License, Version 2.0 (the "License");
00005  *    you may not use this file except in compliance with the License.
00006  *    You may obtain a copy of the License at
00007  * 
00008  *        http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  *    Unless required by applicable law or agreed to in writing, software
00011  *    distributed under the License is distributed on an "AS IS" BASIS,
00012  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *    See the License for the specific language governing permissions and
00014  *    limitations under the License.
00015  */
00016 
00017 #ifndef DTN_API_H
00018 #define DTN_API_H
00019 
00020 #include "dtn_errno.h"
00021 #include "dtn_types.h"
00022 
00026 typedef int* dtn_handle_t;
00027 
00028 #ifdef  __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 /*************************************************************
00033  *
00034  *                     API Functions
00035  *
00036  *************************************************************/
00037 
00045 extern int dtn_open(dtn_handle_t* handle);
00046 
00050 extern int dtn_close(dtn_handle_t handle);
00051 
00055 extern int dtn_errno(dtn_handle_t handle);
00056 
00060 char* dtn_strerror(int err);
00061 
00066 extern int dtn_build_local_eid(dtn_handle_t handle,
00067                                dtn_endpoint_id_t* local_eid,
00068                                const char* service_tag);
00069 
00077 extern int dtn_register(dtn_handle_t handle,
00078                         dtn_reg_info_t* reginfo,
00079                         dtn_reg_id_t* newregid);
00080 
00091 extern int dtn_unregister(dtn_handle_t handle,
00092                           dtn_reg_id_t regid);
00093 
00099 extern int dtn_find_registration(dtn_handle_t handle,
00100                                  dtn_endpoint_id_t* eid,
00101                                  dtn_reg_id_t* regid);
00102 
00106 extern int dtn_change_registration(dtn_handle_t handle,
00107                                    dtn_reg_id_t newregid,
00108                                    dtn_reg_info_t *reginfo);
00109 
00114 extern int dtn_bind(dtn_handle_t handle, dtn_reg_id_t regid);
00115 
00122 extern int dtn_unbind(dtn_handle_t handle, dtn_reg_id_t regid);
00123 
00127 extern int dtn_send(dtn_handle_t handle,
00128                     dtn_bundle_spec_t* spec,
00129                     dtn_bundle_payload_t* payload,
00130                     dtn_bundle_id_t* id);
00131 
00143 extern int dtn_recv(dtn_handle_t handle,
00144                     dtn_bundle_spec_t* spec,
00145                     dtn_bundle_payload_location_t location,
00146                     dtn_bundle_payload_t* payload,
00147                     dtn_timeval_t timeout);
00148 
00163 extern int dtn_begin_poll(dtn_handle_t handle, dtn_timeval_t timeout);
00164 
00168 extern int dtn_cancel_poll(dtn_handle_t handle);
00169 
00170 /*************************************************************
00171  *
00172  *                     Utility Functions
00173  *
00174  *************************************************************/
00175 
00179 extern void dtn_copy_eid(dtn_endpoint_id_t* dst, dtn_endpoint_id_t* src);
00180 
00185 extern int dtn_parse_eid_string(dtn_endpoint_id_t* eid, const char* str);
00186 
00194 extern int dtn_set_payload(dtn_bundle_payload_t* payload,
00195                            dtn_bundle_payload_location_t location,
00196                            char* val, int len);
00197 
00202 void dtn_free_payload(dtn_bundle_payload_t* payload);
00203 
00207 const char* dtn_status_report_reason_to_str(dtn_status_report_reason_t err);
00208 
00209 #ifdef  __cplusplus
00210 }
00211 #endif
00212 
00213 #endif /* DTN_API_H */

Generated on Thu Jun 7 12:54:26 2007 for DTN Reference Implementation by  doxygen 1.5.1