123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- /* File : csharp.i
- * http://www.swig.org/Doc1.3/CSharp.html
- */
- %define %cs_marshal_array(TYPE, CSTYPE)
- %typemap(ctype) TYPE[] "void*"
- %typemap(imtype,
- inattributes="[MarshalAs(UnmanagedType.LPArray)]") TYPE[] "CSTYPE[]"
- %typemap(cstype) TYPE[] "CSTYPE[]"
- %typemap(in) TYPE[] %{ $1 = (TYPE*)$input; %}
- %typemap(csin) TYPE[] "$csinput"
- %enddef
- // Mapping void* as IntPtr
- %typemap(ctype) void * "void *"
- %typemap(imtype) void * "IntPtr"
- %typemap(cstype) void * "IntPtr"
- %typemap(csin) void * "$csinput"
- %typemap(in) void * %{ $1 = $input; %}
- %typemap(out) void * %{ $result = $1; %}
- %typemap(csout) void * { return $imcall; }
- %typemap(csdirectorin) void * "$iminput"
- //======== SipMessage ========//
- %typemap(cscode) SipMessage %{
- public byte[] getSipContent() {
- uint clen = this.getSipContentLength();
- if(clen>0){
- IntPtr ptr = Marshal.AllocHGlobal((int)clen);
- this.getSipContent(ptr, clen);
- byte[] bytes = new byte[clen];
- Marshal.Copy(ptr, bytes, 0, bytes.Length);
- Marshal.FreeHGlobal(ptr);
- return bytes;
- }
- return null;
- }
- %}
- //======== MessagingSession ========//
- %typemap(cscode) MessagingSession %{
- public bool send(byte[] buffer) {
- IntPtr ptr = Marshal.AllocHGlobal(buffer.Length);
- Marshal.Copy(buffer, 0, ptr, buffer.Length);
- bool ret = this.send(ptr, (uint)buffer.Length);
- Marshal.FreeHGlobal(ptr);
- return ret;
- }
- %}
- //======== InfoSession ========//
- %typemap(cscode) InfoSession %{
- public bool send(byte[] buffer, ActionConfig config) {
- IntPtr ptr = Marshal.AllocHGlobal(buffer.Length);
- Marshal.Copy(buffer, 0, ptr, buffer.Length);
- bool ret = this.send(ptr, (uint)buffer.Length, config);
- Marshal.FreeHGlobal(ptr);
- return ret;
- }
- %}
- //======= MediaContent ========//
- %typemap(cscode) MediaContent %{
- public byte[] getPayload() {
- uint clen = this.getPayloadLength();
- if(clen>0){
- IntPtr ptr = Marshal.AllocHGlobal((int)clen);
- this.getPayload(ptr, clen);
- byte[] bytes = new byte[clen];
- Marshal.Copy(ptr, bytes, 0, bytes.Length);
- Marshal.FreeHGlobal(ptr);
- return bytes;
- }
- return null;
- }
- %}
- //======= SMSData ========//
- %typemap(cscode) SMSData %{
- public byte[] getPayload() {
- uint clen = this.getPayloadLength();
- if(clen>0){
- IntPtr ptr = Marshal.AllocHGlobal((int)clen);
- this.getPayload(ptr, clen);
- byte[] bytes = new byte[clen];
- Marshal.Copy(ptr, bytes, 0, bytes.Length);
- Marshal.FreeHGlobal(ptr);
- return bytes;
- }
- return null;
- }
- %}
- //======= RPMessage ========//
- %typemap(cscode) RPMessage %{
- public byte[] getPayload() {
- uint clen = this.getPayloadLength();
- if(clen>0){
- IntPtr ptr = Marshal.AllocHGlobal((int)clen);
- this.getPayload(ptr, clen);
- byte[] bytes = new byte[clen];
- Marshal.Copy(ptr, bytes, 0, bytes.Length);
- Marshal.FreeHGlobal(ptr);
- return bytes;
- }
- return null;
- }
- %}
- //======== XcapStack ========//
- %typemap(cscode) XcapStack %{
- public bool putElement(string url, byte[] payload) {
- IntPtr ptr = Marshal.AllocHGlobal(payload.Length);
- Marshal.Copy(payload, 0, ptr, payload.Length);
- bool ret = this.putElement(url, ptr, (uint)payload.Length);
- Marshal.FreeHGlobal(ptr);
- return ret;
- }
-
- public bool putAttribute(string url, byte[] payload) {
- IntPtr ptr = Marshal.AllocHGlobal(payload.Length);
- Marshal.Copy(payload, 0, ptr, payload.Length);
- bool ret = this.putAttribute(url, ptr, (uint)payload.Length);
- Marshal.FreeHGlobal(ptr);
- return ret;
- }
-
- public bool putDocument(string url, byte[] payload, string contentType) {
- IntPtr ptr = Marshal.AllocHGlobal(payload.Length);
- Marshal.Copy(payload, 0, ptr, payload.Length);
- bool ret = this.putDocument(url, ptr, (uint)payload.Length, contentType);
- Marshal.FreeHGlobal(ptr);
- return ret;
- }
- %}
- //======== Deprecated ========//
- // @deprecated: to be replaced by "tmedia_codec_id_t" in Doubango 3.0
- %typemap(csattributes) tdav_codec_id_e "[System.Obsolete(\"Deprecated and replaced by 'tmedia_codec_id_t'. Will be removed in Doubango 3.0.\", false)]"
- %include ../_common/tinyWRAP.i
|