[omniORB-dev] omniNames patch for NAT
Steve Sexton
steve@sextons.net
Mon, 5 May 2003 23:19:14 -0400
In case any one is interested.
The following patch (against the 4.0.1 release) to omniNames adds a
"-ignoreport"
option for the purpose of bypassing the code that adds the
"-ORBendPoint" option to
ORB_init. I needed this to stop my NAT'd omniNames service from
sending out its
10.x.x.x address in IOR's. Obviously if you use it you need to supply
other
-ORBendPointXXX options, such as the NAT combo -ORBendPointNoPublish
and -ORBendPointNoListen.
I do hope this finds its way into the baseline. = )
Index: omniNames.cc
===================================================================
RCS file:
/home/cvsroot/omniorb/omniorb/src/appl/omniNames/omniNames.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- omniNames.cc 26 Apr 2003 04:32:33 -0000 1.1
+++ omniNames.cc 6 May 2003 02:15:54 -0000 1.2
@@ -58,6 +58,7 @@
cerr << "\nusage: omniNames [-start [<port>]]\n"
<< " [-logdir <directory name>]\n"
<< " [-errlog <file name>]\n"
+ << " [-ignoreport]\n"
<< " [<omniORB-options>...]" << endl;
cerr << "\nUse -start option to start omniNames for the first time."
<< endl
@@ -66,6 +67,7 @@
<< endl;
cerr << "\nUse -logdir option to specify the directory where the
log/data files are kept.\n";
cerr << "\nUse -errlog option to specify where standard error output
is redirected.\n";
+ cerr << "\nUse -ignoreport option to ignore the port
specification.\n";
cerr << "\nYou can also set the environment variable " <<
LOGDIR_ENV_VAR
<< " to specify the\ndirectory where the log/data files are
kept.\n"
<< endl;
@@ -114,6 +116,7 @@
int port = 0;
char* logdir = 0;
+ int ignoreport = 0;
while (argc > 1) {
if (strcmp(argv[1], "-start") == 0) {
@@ -126,6 +129,10 @@
removeArgs(argc, argv, 1, 2);
}
}
+ else if (strcmp(argv[1], "-ignoreport") == 0) {
+ ignoreport = 1;
+ removeArgs(argc, argv, 1, 1);
+ }
else if (strcmp(argv[1], "-logdir") == 0) {
if (argc < 3) usage();
logdir = argv[2];
@@ -165,12 +172,16 @@
// Add a fake command line option to tell the POA which port to use.
//
- insertArgs(argc, argv, 1, 4);
- argv[1] = strdup("-ORBendPoint");
- argv[2] = new char[20];
- sprintf(argv[2], "giop:tcp::%d", port);
- argv[3] = strdup("-ORBpoaUniquePersistentSystemIds");
- argv[4] = strdup("1");
+ if (ignoreport) {
+ insertArgs(argc, argv, 1, 2);
+ } else {
+ insertArgs(argc, argv, 1, 4);
+ argv[3] = strdup("-ORBendPoint");
+ argv[4] = new char[20];
+ sprintf(argv[4], "giop:tcp::%d", port);
+ }
+ argv[1] = strdup("-ORBpoaUniquePersistentSystemIds");
+ argv[2] = strdup("1");
//
// Initialize the ORB and the object adapter.