You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2019-09-24 12:10:44: @nanangizzcreated the issue on trac ticket 2233
Currently we use SWIG default typemap for enumeration, i.e: typesafe enums. But now we find that it may not be the best approach for PJSIP (see pro vs cons below). This ticket will change the typemap to type-unsafe enums.
Pro:
Some PJSIP C enumerations are actually not pure enumeration, for example PJSIP_TRANSPORT_IPV6 in pjsip_transport_type_e is actually a bitflag value.
Method swigToEnum() generated by SWIG for typesafe enum contains iteration which is not efficient on enumeration types whose big and non-contiguous values, e.g: pj_ssl_cert_verify_flag_t whose values ranging from 0 to (1<<31) with exponentially increased intervals.
Some PJSIP enumerations define only subset values, e.g: pj_ssl_cipher only defines some basic SSL/TLS ciphers, so any Java variable typed pj_ssl_cipher or function returning pj_ssl_cipher cannot contain or return non basic ciphers.
Cons:
Backward compatibility issue!
Changes to be done in application
As described above, this ticket introduces backward compatibility issues, here are modifications needed to be done in Java applications:
accessing enumeration value is no longer using swigValue() method, e.g: pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED.swigValue() must be changed to pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED.
all enumeration types are now int, e.g: pjsip_status_code code must be changed to int code
2019-09-24 12:12:47: @nanangizzchanged status from new to closed
2019-09-24 12:10:44: @nanangizz created the issue on trac ticket 2233
Currently we use SWIG default typemap for enumeration, i.e: typesafe enums. But now we find that it may not be the best approach for PJSIP (see pro vs cons below). This ticket will change the typemap to type-unsafe enums.
Pro:
swigToEnum()
generated by SWIG for typesafe enum contains iteration which is not efficient on enumeration types whose big and non-contiguous values, e.g:pj_ssl_cert_verify_flag_t
whose values ranging from 0 to (1<<31) with exponentially increased intervals.pj_ssl_cipher
only defines some basic SSL/TLS ciphers, so any Java variable typedpj_ssl_cipher
or function returningpj_ssl_cipher
cannot contain or return non basic ciphers.Cons:
Changes to be done in application
As described above, this ticket introduces backward compatibility issues, here are modifications needed to be done in Java applications:
swigValue()
method, e.g:pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED.swigValue()
must be changed topjsip_inv_state.PJSIP_INV_STATE_CONFIRMED
.int
, e.g:pjsip_status_code code
must be changed toint code
2019-09-24 12:12:47: @nanangizz changed status from new to closed
2019-09-24 12:12:47: @nanangizz set owner to @nanangizz
2019-09-24 12:12:47: @nanangizz set resolution to fixed
2019-09-24 12:12:47: @nanangizz commented
In r6075:
Close #2233: Changed enumeration approach in SWIG Java to type-unsafe enums.
The text was updated successfully, but these errors were encountered: