@@ -33,7 +33,8 @@ static volatile uint8_t tc_seq_num = 0;
3333static volatile uint8_t tc_vcid = CRYPTO_STANDALONE_FRAMING_VCID ;
3434static volatile uint8_t tc_debug = 1 ;
3535static volatile uint8_t tm_debug = 0 ;
36- static volatile uint8_t crypto_use_tcp = STANDALONE_TCP ? 1 : 0 ;
36+ // static volatile uint8_t crypto_use_tcp = STANDALONE_TCP ? 1 : 0;
37+ static volatile uint8_t crypto_use_tcp = 0 ;
3738
3839/*
3940** Functions
@@ -421,7 +422,8 @@ int32_t crypto_standalone_socket_init(udp_info_t *sock, int32_t port, uint8_t bi
421422 }
422423 else
423424 {
424- if (crypto_use_tcp == 0 && bind_sock == 1 && sock -> port == TM_PROCESS_PORT )
425+ // if (crypto_use_tcp == 0 && bind_sock == 1 && sock->port == TM_PROCESS_PORT)
426+ if (crypto_use_tcp == 0 && bind_sock == 1 )
425427 {
426428 status = bind (sock -> sockfd , (struct sockaddr * )& sock -> saddr , sizeof (sock -> saddr ));
427429 if (status != 0 )
@@ -915,12 +917,28 @@ int main(int argc, char *argv[])
915917 int num_input_tokens ;
916918 int cmd ;
917919 char * token_ptr ;
920+ char * tcp_var = getenv ("STANDALONE_TCP" );
921+ if (tcp_var != NULL ) {
922+ crypto_use_tcp = atoi (tcp_var );
923+ } else {
924+ crypto_use_tcp = 1 ; // Default to TCP if the variable is not defined
925+ }
918926
919927 udp_interface_t tc_apply ;
920928 udp_interface_t tm_process ;
921929
922930 pthread_t tc_apply_thread ;
923931 pthread_t tm_process_thread ;
932+ char * CRYPTOLIB_HOSTNAME ;
933+ CRYPTOLIB_HOSTNAME = getenv ("CRYPTO_HOST" );
934+ if (CRYPTOLIB_HOSTNAME == NULL ) {
935+ CRYPTOLIB_HOSTNAME = "0.0.0.0" ; //only using this if cant find hostname env variable
936+ }
937+ char * GSW_HOSTNAME ;
938+ GSW_HOSTNAME = getenv ("GSWALIAS" );
939+ if (GSW_HOSTNAME == NULL ) {
940+ GSW_HOSTNAME = "cosmos" ; //default if env var not specified
941+ }
924942
925943 tc_apply .read .ip_address = CRYPTOLIB_HOSTNAME ;
926944 tc_apply .read .port = TC_APPLY_PORT ;
@@ -929,6 +947,9 @@ int main(int argc, char *argv[])
929947 tm_process .read .ip_address = CRYPTOLIB_HOSTNAME ;
930948 tm_process .read .port = TM_PROCESS_PORT ;
931949 tm_process .write .ip_address = GSW_HOSTNAME ;
950+ if (strcmp (tm_process .write .ip_address , "yamcs" )== 0 && strcmp (CRYPTOLIB_HOSTNAME , "cryptolib2" )== 0 ){
951+ tm_process .read .port = 8013 ;
952+ }
932953 tm_process .write .port = TM_PROCESS_FWD_PORT ;
933954
934955 printf ("Starting CryptoLib in standalone mode! \n" );
@@ -977,7 +998,8 @@ int main(int argc, char *argv[])
977998 if (keepRunning == CRYPTO_LIB_SUCCESS )
978999 {
9791000 status =
980- crypto_standalone_socket_init (& tm_process .read , TM_PROCESS_PORT , 1 , crypto_use_tcp ); // tcp, accept() 8011
1001+ // crypto_standalone_socket_init(&tm_process.read, TM_PROCESS_PORT, 1, crypto_use_tcp); // tcp, accept() 8011
1002+ crypto_standalone_socket_init (& tm_process .read , tm_process .read .port , 1 , crypto_use_tcp ); // tcp, accept() 8011 or 8013
9811003 if (status != CRYPTO_LIB_SUCCESS )
9821004 {
9831005 printf ("crypto_standalone_socket_init tm_apply.read failed with status %d \n" , status );
0 commit comments