Building errors under Linux (Semaphore, SRTP functions and -members)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Benny,

Thank you for fixing the bug! After SVN update I can't build pjsip project under Linux (Windows works fine):

1) Unknown type sem_t.

I have found different defines for Semaphore:

The define in /pjlib/include/pj/config.h:598 is:
#ifndef PJ_HAS_SEMAPHORE 
  #define PJ_HAS_SEMAPHORE 1
#endif

But the usage in /pjlib/src/pj/os_core_unix.c:37 is:
#if defined(PJ_HAS_SEMAPHORE_H) && PJ_HAS_SEMAPHORE_H != 0
#  include <semaphore.h>
#endif

In source file I have replaced PJ_HAS_SEMAPHORE_H with PJ_HAS_SEMAPHORE and it works.


2) Missing reference to some srtp functions in transport_srtp.c

I have defined PJMEDIA_HAS_SRTP to 0 in config_site. With this define I got another errors (Windows and Linux) which I have fixed
with adding

#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0)
...
#endif

I have added this on the following code blocks:

### pjsua_app.c ###

Line 1326:

    /* SRTP */
    if (app_config.cfg.use_srtp != PJSUA_DEFAULT_USE_SRTP) {
	pj_ansi_sprintf(line, "--use-srtp %d\n",
			app_config.cfg.use_srtp);
	pj_strcat2(&cfg, line);
    }
    if (app_config.cfg.srtp_secure_signaling != 
	PJSUA_DEFAULT_SRTP_SECURE_SIGNALING) 
    {
	pj_ansi_sprintf(line, "--srtp-secure %d\n",
			app_config.cfg.srtp_secure_signaling);
	pj_strcat2(&cfg, line);
    }

### pcaputil.c:248 ###

    /* Create SRTP transport is needed */
    if (srtp_crypto->slen) {
	pjmedia_srtp_crypto crypto;

	pj_bzero(&crypto, sizeof(crypto));
	crypto.key = *srtp_key;
	crypto.name = *srtp_crypto;
	T( pjmedia_transport_srtp_create(app.mept, NULL, NULL, &app.srtp) );
	T( pjmedia_transport_srtp_start(app.srtp, &crypto, &crypto) );
    }


### pcaputil.c:157 ###

	/* Decrypt SRTP */
	if (app.srtp) {
	    int len = sz;
	    status = pjmedia_transport_srtp_decrypt_pkt(app.srtp, PJ_TRUE, 
						        buf, &len);
	    if (status != PJ_SUCCESS) {
		char errmsg[PJ_ERR_MSG_SIZE];
		pj_strerror(status, errmsg, sizeof(errmsg));
		printf("SRTP packet decryption failed, skipping packet: %s\n", 
			errmsg);
		continue;
	    }
	    sz = len;

	    /* Decode RTP packet again */
	    status = pjmedia_rtp_decode_rtp(&app.rtp_sess, buf, sz, &r,
					    &p, payload_size);
	    if (status != PJ_SUCCESS) {
		char errmsg[PJ_ERR_MSG_SIZE];
		pj_strerror(status, errmsg, sizeof(errmsg));
		printf("Not RTP packet, skipping packet: %s\n", errmsg);
		continue;
	    }
	}

Now building project on Windows and Linux works fine.

Best regards,
Helmut






[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux