Commit 6a47f9e7 authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

Merge branch 'develop_integration_2019_w07_v2' into 'develop'

Develop integration 2019 week 07 v2

See merge request oai/openairinterface5g!508
parents 52754797 d14ad679
...@@ -61,3 +61,4 @@ v1.0.0 -> January 2019. This version first implements the architectural split de ...@@ -61,3 +61,4 @@ v1.0.0 -> January 2019. This version first implements the architectural split de
S1-flex has been introduced. S1-flex has been introduced.
New tools: config library, telnet server, ... New tools: config library, telnet server, ...
A lot of bugfixes and a proper automated Continuous Integration process validates contributions. A lot of bugfixes and a proper automated Continuous Integration process validates contributions.
v1.0.1 -> February 2019: Bug fix for the UE L1 simulator.
...@@ -104,6 +104,7 @@ pipeline { ...@@ -104,6 +104,7 @@ pipeline {
} else { } else {
echo "Git Branch is ${GIT_BRANCH}" echo "Git Branch is ${GIT_BRANCH}"
echo "Git Commit is ${GIT_COMMIT}" echo "Git Commit is ${GIT_COMMIT}"
sh "git log -n1 --pretty=format:\"%s\" > .git/CI_COMMIT_MSG"
sh "zip -r -qq localZip.zip ." sh "zip -r -qq localZip.zip ."
// Running astyle options on all C/H files in the repository // Running astyle options on all C/H files in the repository
...@@ -260,7 +261,7 @@ pipeline { ...@@ -260,7 +261,7 @@ pipeline {
expression {doRedHatBuild} expression {doRedHatBuild}
} }
steps { steps {
gitlabCommitStatus(name: "Build eNb-USRP-CentOS") { gitlabCommitStatus(name: "Build eNb-USRP-RHE") {
script { script {
try { try {
withCredentials([ withCredentials([
...@@ -572,6 +573,10 @@ OAI CI Team''', ...@@ -572,6 +573,10 @@ OAI CI Team''',
replyTo: 'no-reply@openairinterface.org', replyTo: 'no-reply@openairinterface.org',
subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!', subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!',
to: env.gitlabUserEmail to: env.gitlabUserEmail
if (fileExists('.git/CI_COMMIT_MSG')) {
sh "rm -f .git/CI_COMMIT_MSG"
}
} }
} }
success { success {
......
// *INDENT-OFF* cppcheck doesn't like "astyling" this file!!!!
// /*
// * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
// * contributor license agreements. See the NOTICE file distributed with
// * this work for additional information regarding copyright ownership.
// * The OpenAirInterface Software Alliance licenses this file to You under
// * the OAI Public License, Version 1.1 (the "License"); you may not use this file
// * except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.openairinterface.org/?page_id=698
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// *-------------------------------------------------------------------------------
// * For more information about the OpenAirInterface (OAI) Software Alliance:
// * contact@openairinterface.org
// */
//*****************************************************************************
//*****************************************************************************
// section for "valid" memory leaks: the related functions are allocators and
// the caller is responsible of freeing the memory. cppcheck has a mechanism
// to check more accuretaly this, by defining callers responsible of freeing
// but tools like valgring might be more suitable
//
//-----------------------------------------------------------------------------
// suppress error about keysP memory leak, free must be done by calling func
memleak:common/utils/hashtable/obj_hashtable.c
//-----------------------------------------------------------------------------
// suppress error about keys memory leak, free must be done by calling func
memleak:openair2/UTIL/OMG/omg_hashtable.c
//-----------------------------------------------------------------------------
// suppress error about data memory leak. This is the buffer where
// _emm_as_encode function creates the encoded buffer
//
memleak:openair3/NAS/UE/EMM/SAP/emm_as.c
//-----------------------------------------------------------------------------
//*****************************************************************************
// section for files not used in oai exec's included in CI.
// Possibly candidates for removal otherwise should be documented and updated
// for project rules enforcement
// ----------------------------------------------------------------------------
// likely sources for test programs, maintained?
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/ltetest.c
memleak:openair1/PHY/CODING/TESTBENCH/ltetest.c
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/pdcch_test.c
//
//-----------------------------------------------------------------------------
// oaisim deprecated, remove?
doubleFree:openair3/TEST/oaisim_mme_list_benchmark.c
//
//-----------------------------------------------------------------------------
// is itti analyzer deprecated
nullPointer:common/utils/itti_analyzer/itti_analyzer.c
nullPointerRedundantCheck:common/utils/itti_analyzer/libbuffers/buffers.c
doubleFree:common/utils/itti_analyzer/libbuffers/socket.c
memleak:common/utils/itti_analyzer/libbuffers/socket.c
memleak:common/utils/itti_analyzer/libparser/array_type.c
memleak:common/utils/itti_analyzer/libui/ui_callbacks.c
//-----------------------------------------------------------------------------
// obviously never even compiled!!!
syntaxError:openair1/SIMULATION/LTE_PHY/dlsim_tm4.c
//-----------------------------------------------------------------------------
// omg, otg commented out in cmakelist to be cleaned up definitely?
arrayIndexOutOfBounds:openair2/UTIL/OMG/omg.c
uninitvar:openair2/UTIL/OTG/otg_rx_socket.c
//
//*****************************************************************************
//
// True problems we don't know how to fix, Suppression is commented out,
// as these kind of problem need either to be fixed or can be suppressed
// when fully uderstood
//-----------------------------------------------------------------------------
// the function [nv]fapi_pnf_p7_config_create should return
// _this. _this points to a structure and a dynamically allocated field is
// returned. cppcheck suspects _this will never be released, so do i
// memleak:nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c
// memleak:nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c
//-----------------------------------------------------------------------------
// may be security_data->kenb.value is released from calling functions. But even
// when, for test, freeing it before returning from emm_proc_security_mode_command
// which does the allocation, cppcheck complains. So something might be wrong...
// memleak:openair3/NAS/UE/EMM/SecurityModeControl.c
//-----------------------------------------------------------------------------
// when used, nobody but the original developer can guess if sn_data_cnf is set or not
// cppcheck found that in some cases it is not, code needs cleanup before fixing that...
// uninitvar:openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
//*****************************************************************************
// *INDENT-ON*
...@@ -121,6 +121,7 @@ git config user.email "jenkins@openairinterface.org" ...@@ -121,6 +121,7 @@ git config user.email "jenkins@openairinterface.org"
git config user.name "OAI Jenkins" git config user.name "OAI Jenkins"
git checkout -f $SOURCE_COMMIT_ID git checkout -f $SOURCE_COMMIT_ID
git log -n1 --pretty=format:\"%s\" > .git/CI_COMMIT_MSG
git merge --ff $TARGET_COMMIT_ID -m "Temporary merge for CI" git merge --ff $TARGET_COMMIT_ID -m "Temporary merge for CI"
......
...@@ -264,7 +264,7 @@ case $key in ...@@ -264,7 +264,7 @@ case $key in
ARCHIVES_LOC=cppcheck ARCHIVES_LOC=cppcheck
LOG_PATTERN=cppcheck.xml LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1 NB_PATTERN_FILES=1
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2" BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list"
NBARGS=$[$NBARGS+256] NBARGS=$[$NBARGS+256]
shift shift
;; ;;
...@@ -340,11 +340,11 @@ case $key in ...@@ -340,11 +340,11 @@ case $key in
;; ;;
cppcheck) cppcheck)
VM_NAME=ci-cppcheck VM_NAME=ci-cppcheck
VM_MEMORY=8192 VM_MEMORY=4096
ARCHIVES_LOC=cppcheck ARCHIVES_LOC=cppcheck
LOG_PATTERN=cppcheck.xml LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1 NB_PATTERN_FILES=1
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2" BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list"
NBARGS=$[$NBARGS+256] NBARGS=$[$NBARGS+256]
;; ;;
enb-ethernet) enb-ethernet)
......
...@@ -363,6 +363,14 @@ function report_build { ...@@ -363,6 +363,14 @@ function report_build {
echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Commit ID</td>" >> ./build_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Commit ID</td>" >> ./build_results.html
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html echo " </tr>" >> ./build_results.html
if [ -e .git/CI_COMMIT_MSG ]
then
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-comment\"></span> Commit Message</td>" >> ./build_results.html
MSG=`cat .git/CI_COMMIT_MSG`
echo " <td>$MSG</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html
fi
fi fi
if [ $MR_TRIG -eq 1 ] if [ $MR_TRIG -eq 1 ]
then then
...@@ -374,6 +382,14 @@ function report_build { ...@@ -374,6 +382,14 @@ function report_build {
echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Source Commit ID</td>" >> ./build_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Source Commit ID</td>" >> ./build_results.html
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html echo " </tr>" >> ./build_results.html
if [ -e .git/CI_COMMIT_MSG ]
then
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-comment\"></span> Source Commit Message</td>" >> ./build_results.html
MSG=`cat .git/CI_COMMIT_MSG`
echo " <td>$MSG</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html
fi
echo " <tr>" >> ./build_results.html echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-log-in\"></span> Target Branch</td>" >> ./build_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-log-in\"></span> Target Branch</td>" >> ./build_results.html
echo " <td>$TARGET_BRANCH</td>" >> ./build_results.html echo " <td>$TARGET_BRANCH</td>" >> ./build_results.html
...@@ -492,7 +508,7 @@ function report_build { ...@@ -492,7 +508,7 @@ function report_build {
if [ -e ./archives/red_hat ] if [ -e ./archives/red_hat ]
then then
echo " <h2>Red Hat (CentOS Linux release 7.4.1708) -- Summary</h2>" >> ./build_results.html echo " <h2>Red Hat Enterprise Linux Server release 7.6) -- Summary</h2>" >> ./build_results.html
summary_table_header "Red Hat -- OAI Build eNB -- USRP option" ./archives/red_hat summary_table_header "Red Hat -- OAI Build eNB -- USRP option" ./archives/red_hat
summary_table_row "LTE SoftModem - Release 14" ./archives/red_hat/lte-softmodem.Rel14.txt "Built target lte-softmodem" ./enb_usrp_rh_row1.html summary_table_row "LTE SoftModem - Release 14" ./archives/red_hat/lte-softmodem.Rel14.txt "Built target lte-softmodem" ./enb_usrp_rh_row1.html
......
...@@ -139,6 +139,14 @@ function report_test { ...@@ -139,6 +139,14 @@ function report_test {
echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Commit ID</td>" >> ./test_simulator_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Commit ID</td>" >> ./test_simulator_results.html
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html echo " <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html echo " </tr>" >> ./test_simulator_results.html
if [ -e .git/CI_COMMIT_MSG ]
then
echo " <tr>" >> ./test_simulator_results.html
echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-comment\"></span> Commit Message</td>" >> ./test_simulator_results.html
MSG=`cat .git/CI_COMMIT_MSG`
echo " <td>$MSG</td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html
fi
fi fi
if [ $MR_TRIG -eq 1 ] if [ $MR_TRIG -eq 1 ]
then then
...@@ -150,6 +158,14 @@ function report_test { ...@@ -150,6 +158,14 @@ function report_test {
echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Source Commit ID</td>" >> ./test_simulator_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Source Commit ID</td>" >> ./test_simulator_results.html
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html echo " <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html echo " </tr>" >> ./test_simulator_results.html
if [ -e .git/CI_COMMIT_MSG ]
then
echo " <tr>" >> ./test_simulator_results.html
echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-comment\"></span> Commit Message</td>" >> ./test_simulator_results.html
MSG=`cat .git/CI_COMMIT_MSG`
echo " <td>$MSG</td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html
fi
echo " <tr>" >> ./test_simulator_results.html echo " <tr>" >> ./test_simulator_results.html
echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-log-in\"></span> Target Branch</td>" >> ./test_simulator_results.html echo " <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-log-in\"></span> Target Branch</td>" >> ./test_simulator_results.html
echo " <td>$TARGET_BRANCH</td>" >> ./test_simulator_results.html echo " <td>$TARGET_BRANCH</td>" >> ./test_simulator_results.html
......
...@@ -569,6 +569,7 @@ function start_l2_sim_enb { ...@@ -569,6 +569,7 @@ function start_l2_sim_enb {
ENB_SYNC=1 ENB_SYNC=1
echo "L2-SIM eNB is sync'ed: waiting for UE(s) to connect" echo "L2-SIM eNB is sync'ed: waiting for UE(s) to connect"
fi fi
sleep 10
} }
function start_l2_sim_ue { function start_l2_sim_ue {
...@@ -604,10 +605,34 @@ function start_l2_sim_ue { ...@@ -604,10 +605,34 @@ function start_l2_sim_ue {
if [ $i -lt 50 ] if [ $i -lt 50 ]
then then
UE_SYNC=0 UE_SYNC=0
echo "L2-SIM UE is NOT sync'ed w/eNB" echo "L2-SIM UE is NOT sync'ed w/ eNB"
return
else
UE_SYNC=1
echo "L2-SIM UE is sync'ed w/ eNB"
fi
# Checking oip1 interface has now an IP address
i="0"
echo "ifconfig oip1 | egrep -c \"inet addr\"" > $1
while [ $i -lt 10 ]
do
sleep 5
CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1`
if [ $CONNECTED -eq 1 ]
then
i="100"
else
i=$[$i+1]
fi
done
rm $1
if [ $i -lt 50 ]
then
UE_SYNC=0
echo "L2-SIM UE oip1 is NOT sync'ed w/ EPC"
else else
UE_SYNC=1 UE_SYNC=1
echo "L2-SIM UE is sync'ed w/eNB" echo "L2-SIM UE oip1 is sync'ed w/ EPC"
fi fi
sleep 10 sleep 10
} }
......
...@@ -102,6 +102,7 @@ check_supported_distribution() { ...@@ -102,6 +102,7 @@ check_supported_distribution() {
"ubuntu14.04") return 0 ;; "ubuntu14.04") return 0 ;;
"fedora24") return 0 ;; "fedora24") return 0 ;;
"rhel7") return 0 ;; "rhel7") return 0 ;;
"rhel7.6") return 0 ;;
"centos7") return 0 ;; "centos7") return 0 ;;
esac esac
return 1 return 1
...@@ -310,10 +311,20 @@ install_usrp_uhd_driver() { ...@@ -310,10 +311,20 @@ install_usrp_uhd_driver() {
# On newer kernels, it fails to install # On newer kernels, it fails to install
$SUDO apt-get -y install uhd-host $SUDO apt-get -y install uhd-host
fi fi
# quick workaround for RHE7.6
local distribution=$(get_distribution_release)
if [ -z $1 ]; then if [ -z $1 ]; then
$SUDO uhd_images_downloader if [[ "$distribution" == "rhel7.6" ]]; then
$SUDO /usr/local/bin/uhd_images_downloader
else
$SUDO uhd_images_downloader
fi
else else
$SUDO uhd_images_downloader -i $1 if [[ "$distribution" == "rhel7.6" ]]; then
$SUDO /usr/local/bin/uhd_images_downloader -i $1
else
$SUDO uhd_images_downloader -i $1
fi
fi fi
} }
......
...@@ -166,13 +166,14 @@ int config_check_unknown_cmdlineopt(char *prefix) { ...@@ -166,13 +166,14 @@ int config_check_unknown_cmdlineopt(char *prefix) {
int unknowndetected=0; int unknowndetected=0;
char testprefix[CONFIG_MAXOPTLENGTH]; char testprefix[CONFIG_MAXOPTLENGTH];
int finalcheck = 0; int finalcheck = 0;
memset(testprefix,0,sizeof(testprefix));
memset(testprefix,0,sizeof(testprefix)); memset(testprefix,0,sizeof(testprefix));
if (prefix != NULL) { if (prefix != NULL) {
if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0) if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0)
finalcheck = 1; finalcheck = 1;
else if (strlen(prefix) > 0) { else if (strlen(prefix) > 0) {
sprintf(testprefix,"--%.*s.",CONFIG_MAXOPTLENGTH-1,prefix); sprintf(testprefix,"--%.*s.",CONFIG_MAXOPTLENGTH-4,prefix);
} }
} }
......
...@@ -31,7 +31,7 @@ typedef struct { ...@@ -31,7 +31,7 @@ typedef struct {
int remote_port; int remote_port;
pthread_mutex_t lock; pthread_mutex_t lock;
pthread_cond_t cond; pthread_cond_t cond;
databuf * volatile head, *tail; databuf *volatile head, *tail;
uint64_t memusage; uint64_t memusage;
uint64_t last_warning_memusage; uint64_t last_warning_memusage;
} forward_data; } forward_data;
...@@ -40,80 +40,115 @@ typedef struct { ...@@ -40,80 +40,115 @@ typedef struct {
/* utility functions */ /* utility functions */
/****************************************************************************/ /****************************************************************************/
static void new_thread(void *(*f)(void *), void *data) static void new_thread(void *(*f)(void *), void *data) {
{
pthread_t t; pthread_t t;
pthread_attr_t att; pthread_attr_t att;
if (pthread_attr_init(&att)) if (pthread_attr_init(&att)) {
{ fprintf(stderr, "pthread_attr_init err\n"); exit(1); } fprintf(stderr, "pthread_attr_init err\n");
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) exit(1);
{ fprintf(stderr, "pthread_attr_setdetachstate err\n"); exit(1); } }
if (pthread_attr_setstacksize(&att, 10000000))
{ fprintf(stderr, "pthread_attr_setstacksize err\n"); exit(1); } if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
if (pthread_create(&t, &att, f, data)) fprintf(stderr, "pthread_attr_setdetachstate err\n");
{ fprintf(stderr, "pthread_create err\n"); exit(1); } exit(1);
if (pthread_attr_destroy(&att)) }
{ fprintf(stderr, "pthread_attr_destroy err\n"); exit(1); }
if (pthread_attr_setstacksize(&att, 10000000)) {
fprintf(stderr, "pthread_attr_setstacksize err\n");
exit(1);
}
if (pthread_create(&t, &att, f, data)) {
fprintf(stderr, "pthread_create err\n");
exit(1);
}
if (pthread_attr_destroy(&att)) {
fprintf(stderr, "pthread_attr_destroy err\n");
exit(1);
}
} }
static int get_connection(char *addr, int port) static int get_connection(char *addr, int port) {
{
struct sockaddr_in a; struct sockaddr_in a;
socklen_t alen; socklen_t alen;
int s, t; int s, t;
printf("T tracer: waiting for connection on %s:%d\n", addr, port); printf("T tracer: waiting for connection on %s:%d\n", addr, port);
s = socket(AF_INET, SOCK_STREAM, 0); s = socket(AF_INET, SOCK_STREAM, 0);
if (s == -1) { perror("socket"); exit(1); }
if (s == -1) {
perror("socket");
exit(1);
}
t = 1; t = 1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &t, sizeof(int)))
{ perror("setsockopt"); exit(1); } if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &t, sizeof(int))) {
perror("setsockopt");
exit(1);
}
a.sin_family = AF_INET; a.sin_family = AF_INET;
a.sin_port = htons(port); a.sin_port = htons(port);
a.sin_addr.s_addr = inet_addr(addr); a.sin_addr.s_addr = inet_addr(addr);
if (bind(s, (struct sockaddr *)&a, sizeof(a))) { perror("bind"); exit(1); } if (bind(s, (struct sockaddr *)&a, sizeof(a))) {
if (listen(s, 5)) { perror("bind"); exit(1); } perror("bind");
exit(1);
}
if (listen(s, 5)) {
perror("bind");
exit(1);
}
alen = sizeof(a); alen = sizeof(a);
t = accept(s, (struct sockaddr *)&a, &alen); t = accept(s, (struct sockaddr *)&a, &alen);
if (t == -1) { perror("accept"); exit(1); }
close(s);
printf("T tracer: connected\n"); if (t == -1) {
perror("accept");
exit(1);
}
close(s);
printf("T tracer: connected\n");
return t; return t;
} }
static void forward(void *_forwarder, char *buf, int size); static void forward(void *_forwarder, char *buf, int size);
void send_T_messages_txt(void *forwarder) void send_T_messages_txt(void *forwarder) {
{
char buf[T_BUFFER_MAX]; char buf[T_BUFFER_MAX];
char *T_LOCAL_buf = buf; char *T_LOCAL_buf = buf;
int T_LOCAL_size; int T_LOCAL_size;
unsigned char *src; unsigned char *src;
int src_len; int src_len;
/* trace T_message.txt /* trace T_message.txt
* Send several messages -1 with content followed by message -2. * Send several messages -1 with content followed by message -2.
*/ */
src = T_messages_txt; src = T_messages_txt;
src_len = T_messages_txt_len; src_len = T_messages_txt_len;
while (src_len) { while (src_len) {
int send_size = src_len; int send_size = src_len;
if (send_size > T_PAYLOAD_MAXSIZE - sizeof(int)) if (send_size > T_PAYLOAD_MAXSIZE - sizeof(int))
send_size = T_PAYLOAD_MAXSIZE - sizeof(int); send_size = T_PAYLOAD_MAXSIZE - sizeof(int);
/* TODO: be careful, we use internal T stuff, to rewrite? */ /* TODO: be careful, we use internal T stuff, to rewrite? */
T_LOCAL_size = 0; T_LOCAL_size = 0;
T_HEADER(T_ID(-1)); T_HEADER(T_ID(-1));
T_PUT_buffer(1, ((T_buffer){addr:(src), length:(send_size)})); T_PUT_buffer(1, ((T_buffer) {
addr:
(src), length:
(send_size)
}));
forward(forwarder, buf, T_LOCAL_size); forward(forwarder, buf, T_LOCAL_size);
src += send_size; src += send_size;
src_len -= send_size; src_len -= send_size;
} }
T_LOCAL_size = 0; T_LOCAL_size = 0;
T_HEADER(T_ID(-2)); T_HEADER(T_ID(-2));
forward(forwarder, buf, T_LOCAL_size); forward(forwarder, buf, T_LOCAL_size);
...@@ -123,49 +158,54 @@ void send_T_messages_txt(void *forwarder) ...@@ -123,49 +158,54 @@ void send_T_messages_txt(void *forwarder)
/* forward functions */ /* forward functions */
/****************************************************************************/ /****************************************************************************/
static void *data_sender(void *_f) static void *data_sender(void *_f) {
{
forward_data *f = _f; forward_data *f = _f;
databuf *cur;