Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
7f9e8d64
Commit
7f9e8d64
authored
Mar 11, 2002
by
Leigh B. Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add nseconfigs command for Shashi. Pretty simple stuff.
parent
d26d5035
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
tmcd/tmcd.c
tmcd/tmcd.c
+65
-0
No files found.
tmcd/tmcd.c
View file @
7f9e8d64
...
...
@@ -71,6 +71,7 @@ static int doloadinfo(int sock, struct in_addr ipaddr,char *rdata,int tcp);
static
int
doreset
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
);
static
int
dorouting
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
);
static
int
dotrafgens
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
);
static
int
donseconfigs
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
);
struct
command
{
char
*
cmdname
;
...
...
@@ -97,6 +98,7 @@ struct command {
{
"reset"
,
doreset
},
{
"routing"
,
dorouting
},
{
"trafgens"
,
dotrafgens
},
{
"nseconfigs"
,
donseconfigs
},
};
static
int
numcommands
=
sizeof
(
command_array
)
/
sizeof
(
struct
command
);
...
...
@@ -2163,6 +2165,69 @@ dotrafgens(int sock, struct in_addr ipaddr, char *rdata, int tcp)
return
0
;
}
/*
* Return nseconfigs info
*/
static
int
donseconfigs
(
int
sock
,
struct
in_addr
ipaddr
,
char
*
rdata
,
int
tcp
)
{
MYSQL_RES
*
res
;
MYSQL_ROW
row
;
char
nodeid
[
32
];
char
pid
[
64
];
char
eid
[
64
];
char
gid
[
64
];
char
buf
[
MYBUFSIZE
],
*
bp
,
*
sp
;
int
nrows
;
if
(
!
tcp
)
{
syslog
(
LOG_ERR
,
"NSECONFIGS: %s: Cannot do UDP mode!"
,
inet_ntoa
(
ipaddr
));
return
1
;
}
if
(
iptonodeid
(
ipaddr
,
nodeid
))
{
syslog
(
LOG_ERR
,
"NSECONFIGS: %s: No such node"
,
inet_ntoa
(
ipaddr
));
return
1
;
}
/*
* Now check reserved table
*/
if
(
nodeidtoexp
(
nodeid
,
pid
,
eid
,
gid
))
{
syslog
(
LOG_ERR
,
"NSECONFIGS: %s: Node is free"
,
nodeid
);
return
1
;
}
res
=
mydb_query
(
"select nseconfig from nseconfigs as nse "
"left join reserved as r on r.vname=nse.vname "
"where r.node_id='%s' and "
" nse.pid='%s' and nse.eid='%s'"
,
1
,
nodeid
,
pid
,
eid
);
if
(
!
res
)
{
syslog
(
LOG_ERR
,
"NSECONFIGS: %s: DB Error getting nseconfigs"
,
nodeid
);
return
1
;
}
if
((
nrows
=
(
int
)
mysql_num_rows
(
res
))
==
0
)
{
mysql_free_result
(
res
);
return
0
;
}
row
=
mysql_fetch_row
(
res
);
/*
* Just shove the whole thing out.
*/
if
(
row
[
0
]
&&
row
[
0
][
0
])
{
client_writeback
(
sock
,
row
[
0
],
strlen
(
row
[
0
]),
tcp
);
}
mysql_free_result
(
res
);
return
0
;
}
/*
* DB stuff
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment