libsrtp icon indicating copy to clipboard operation
libsrtp copied to clipboard

Make a proposal for a new API for a 2.0 release

Open fluffy opened this issue 13 years ago • 13 comments

fluffy avatar Mar 28 '13 23:03 fluffy

I'm in agreement the time has come to commence on 2.0. We should address the opacity issues in the header files, as well as the header file hierarchy. We shouldn't have to install all the crypto/include header files when doing 'make install'. Also, the *_priv.h files shouldn't be installed.

jfigus avatar Oct 08 '14 18:10 jfigus

Wow, so many activity today!

During next days I will propose some stuff that I consider it could be nice to have in a new 2.0 version.

Thanks!

ibc avatar Oct 08 '14 20:10 ibc

In the interim, it would be nice to have a 1.5.0 release which includes the work done in the "feature-openssl" branch. IMHO, that work alone deserves a minor version bump.

saghul avatar Oct 13 '14 09:10 saghul

This sounds reasonable. I'll start working on a 1.5.0 release based on the current master.

jfigus avatar Oct 13 '14 14:10 jfigus

Fantastic! On Oct 13, 2014 4:03 PM, "John Foley" [email protected] wrote:

This sounds reasonable. I'll start working on a 1.5.0 release based on the current master.

— Reply to this email directly or view it on GitHub https://github.com/cisco/libsrtp/issues/15#issuecomment-58896244.

saghul avatar Oct 13 '14 14:10 saghul

Hi, I propose the following guidelines (learnt from libuv) for the 2.0.0 release of libsrtp (sure @saghul will agree):

  • All the public constants exported by libsrtp MUST be prefixed with SRTP_.
    • AES_128_GCM_KEYSIZE_WSALT => SRTP_AES_128_GCM_KEYSIZE_WSALT
  • All the private constants internally used by libsrtp MUST be prefixed with SRTP__.
  • All the public functions, structs and typedef exported by libsrtp MUST be prefixed with srtp_.
    • err_status_t => srtp_err_status_t
    • sec_serv_t => srtp_sec_serv_t
    • cipher_type_id_t => srtp_cipher_type_id_t
  • All the private functions, structs and typedef internally used by libsrtp MUST be prefixed with srtp__.

To make it clear: libsrtp MUST NOT export stuff not starting by "SRTP_" or "srtp_".

ibc avatar Oct 13 '14 16:10 ibc

What's the reasoning for enforcing naming constraints on private functions, structs, constants, etc.? These symbols are not exported by the library.

jfigus avatar Oct 13 '14 16:10 jfigus

@saghul will reply to that :)

ibc avatar Oct 13 '14 16:10 ibc

Seems like that's a pretty big changes for exiting applications that use this.

On Oct 13, 2014, at 10:37 AM, Iñaki Baz Castillo [email protected] wrote:

Hi, I propose the following guidelines (learnt from libuv) for the 2.0.0 release of libsrtp (sure @saghul will agree):

• All the public constants exported by libsrtp MUST be prefixed with SRTP_. • AES_128_GCM_KEYSIZE_WSALT => SRTP_AES_128_GCM_KEYSIZE_WSALT • All the private constants internally used by libsrtp MUST be prefixed with SRTP__. • All the public functions, structs and typedef exported by libsrtp MUST be prefixed with srtp_. • err_status_t => srtp_err_status_t • sec_serv_t => srtp_sec_serv_t • cipher_type_id_t => srtp_cipher_type_id_t • All the private functions, structs and typedef internally used by libsrtp MUST be prefixed with srtp__. To make it clear: libsrtp MUST NOT export stuff not starting by "SRTP_" or "srtp_".

— Reply to this email directly or view it on GitHub.

fluffy avatar Oct 13 '14 17:10 fluffy

This is supposed to be libsrtp 2.0.0, non backward compatible. This is the only chance to properly redesign the library.

ibc avatar Oct 13 '14 17:10 ibc

Existing applications have relied on CVS checkouts, as libsrtp has been in flux for a while. Now that it has picked up some pace, it would be nice to refine the existing and make it better.

One such thing is the (now released) 1.5 release. It includes many improvements and it actually makes it easier for application developers to link with the system libsrtp instead of vendoring it (pkg-config support). This release series (1.5.x) should probably be supported for quite a while IMHO.

Now, moving onwards, @ibc's proposal does make sense to me. In C we have no namespaces, so having some "gentleman's" agreement is desired to avoid symbol conflicts. At least in public headers. This is not so relevant for private structures, but IIRC libsrtp doesn't really hide the private structures at the moment. They are in a private header file, which is included by the public include at some point. Regardless, it's just Good Practice (TM) to have some naming convention, so newcomers find their way around easier. This fosters contributions and makes the code more maintainable in the long run.

These are my 2 cents :-)

saghul avatar Oct 14 '14 07:10 saghul

Is anyone on this thread interested in integration testing the new 2.0 library? If so, the code is in the 2_0_0_dev branch. All the unit tests are passing. I've done some integration testing using doubango. Using doubango as an integration test, the fix-ups are easy to apply, requiring the following:

  1. Header files are now installed into srtp2 (e.g. #include <srtp2/srtp.h>)
  2. When linking the application, use -lsrtp2 instead of -lsrtp
  3. All function names are now prefixed with srtp_
  4. All structs are now prefixed with srtp_ (e.g. srtp_err_status_t)
  5. All public #defines prefixed with SRTP_
  6. libsrtp can no longer be used as a general purpose crypto library. If you were using the RNG in libsrtp, then you'll experience link failures.

jfigus avatar Nov 20 '14 21:11 jfigus

Closing issue due to inactivity.

jfigus avatar Jun 03 '15 17:06 jfigus