summaryrefslogtreecommitdiffstats
path: root/bindings/csharp/csharp.i
blob: dfbe47c78e4b5f24b5cf6b13079885d0d192eb68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* 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 byte[]
%typemap(ctype) void * "void *"
%typemap(imtype) void * "byte[]"
%typemap(cstype) void * "byte[]"
%typemap(csin) void * "$csinput"
%typemap(csout) void * { return $imcall; }
%typemap(in) void * %{ $1 = $input; %}
%typemap(out) void * %{ $result = $1; %}
%typemap(csdirectorin) void * "$iminput"


//======== SipMessage ========//
%typemap(cscode) SipMessage %{
  public byte[] getSipContent() {
    uint clen = this.getSipContentLength();
    if(clen>0){
        byte[] bytes = new byte[clen];
        this.getSipContent(bytes, clen);
        return bytes;
    }
    return null;
  }
%}


//======= MediaContent ========//
%typemap(cscode) MediaContent %{
  public byte[] getPayload() {
    uint clen = this.getPayloadLength();
    if(clen>0){
        byte[] bytes = new byte[clen];
        this.getPayload(bytes, clen);
        return bytes;
    }
    return null;
  }
%}

%include ../_common/tinyWRAP.i
OpenPOWER on IntegriCloud