C语言的结构转体转C# 引用sip的dll,高手进
struct osip_message{
char *sip_version; /**< SIP version (SIP request only) */
osip_uri_t *req_uri; /**< Request-Uri (SIP request only) */
char *sip_method; /**< METHOD (SIP request only) */
int status_code; /**< Status Code (SIP answer only) */
char *reason_phrase; /**< Reason Phrase (SIP answer only) */
osip_list_t accepts; /**< Accept headers */
osip_list_t accept_encodings; /**< Accept-Encoding headers */
osip_list_t accept_languages; /**< Accept-Language headers */
osip_list_t alert_infos; /**< Alert-Info headers */
osip_list_t allows; /**< Allows headers */
osip_list_t authentication_infos;/**< authentication_info headers */
osip_list_t authorizations; /**< Authorizations headers */
osip_call_id_t *call_id; /**< Call-ID header */
osip_list_t call_infos; /**< Call-Infos header */
osip_list_t contacts; /**< Contacts headers */
osip_list_t content_encodings; /**< Content-Encodings headers */
osip_content_length_t *content_length; /**< Content-Length header */
osip_content_type_t *content_type; /**< Content-Type header */
osip_cseq_t *cseq; /**< CSeq header */
osip_list_t error_infos; /**< Error-Info headers */
osip_from_t *from; /**< From header */
osip_mime_version_t *mime_version;/**< Mime-Version header */
osip_list_t proxy_authenticates; /**< Proxy-Authenticate headers */
osip_list_t proxy_authentication_infos; /**< P-Authentication-Info headers */
osip_list_t proxy_authorizations;/**< Proxy-authorization headers */
osip_list_t record_routes; /**< Record-Route headers */
osip_list_t routes; /**< Route headers */
osip_to_t *to; /**< To header */
osip_list_t vias; /**< Vias headers */
osip_list_t www_authenticates; /**< WWW-Authenticate headers */
osip_list_t headers; /**< Other headers */
osip_list_t bodies; /**< List of attachements */
/*
1: structure and buffer "message" are identical.
2: buffer "message" is not up to date with the structure info (call osip_message_to_str to update it).
*/
int message_property; /**@internal */
char *message; /**@internal */
size_t message_length; /**@internal */
void *application_data; /**can be used by upper layer*/
};
以上结构转C#,_t结尾的为另外的结构
另外还有这几个方法也要转:
int eXosip_message_build_request (osip_message_t ** message, const char *method,const char *to, const char *from, const char *route)
int osip_message_set_body (osip_message_t * sip, const char *buf, size_t length);
int osip_message_set_content_type (osip_message_t * sip, const char *hvalue);
int eXosip_message_send_request(osip_message_t *message);
困扰好几天了,谢谢各位高手! --------------------编程问答-------------------- 期待高手~ --------------------编程问答-------------------- ......
char *转为string,有太多不明的字段,别的帮不了你了。
等楼下的高手来打救你把... --------------------编程问答-------------------- 这里有太多的类型定义了。
建议还是自己用C++写个动态库,调用现有的这个类库。
然后返回自己写的这个类库返回简单的数据类型,供C#调用,
这样可以快速完成工作,不然,你光在数据类型定义上和C#调用封装上就要
花费无数时间。 --------------------编程问答-------------------- 谢谢各位朋友,那些带_t的都是一些简单结构的指针。
我已经在尝试写个C++的dll进行封装了 --------------------编程问答-------------------- 你先把那些类型定义贴出来,我来帮你转换。。。 --------------------编程问答--------------------
补充:.NET技术 , C#