Revision: 14392
Author: adrian.chadd
Date: Wed Feb 10 19:53:05 2010
Log: Add an option to set the client-side TOS for submitted requests.
http://code.google.com/p/lusca-cache/source/detail?r=14392
Modified:
/branches/LUSCA_HEAD/tools/squidclient.c
=======================================
--- /branches/LUSCA_HEAD/tools/squidclient.c Thu Jun 26 05:09:24 2008
+++ /branches/LUSCA_HEAD/tools/squidclient.c Wed Feb 10 19:53:05 2010
@@ -145,6 +145,7 @@
"Options:\n"
" -P file PUT request.\n"
" -a Do NOT include Accept: header.\n"
+ " -c <tos> Set ToS for client request.\n"
" -r Force cache to reload URL.\n"
" -s Silent. Do not print data to stdout.\n"
" -v Verbose. Print outgoing message to stderr.\n"
@@ -195,6 +196,8 @@
const char *www_password = NULL;
const char *host = NULL;
const char *version = "1.1";
+ int client_tos = -1;
+ int res;
/* set the defaults */
hostname = "localhost";
@@ -214,11 +217,14 @@
url[BUFSIZ - 1] = '\0';
if (url[0] == '-')
usage(argv[0]);
- while ((c = getopt(argc,
argv, "ah:j:V:l:P:i:km:p:rsvt:g:p:I:H:T:u:U:w:W:?")) != -1)
+ while ((c = getopt(argc,
argv, "ac:h:j:V:l:P:i:km:p:rsvt:g:p:I:H:T:u:U:w:W:?")) != -1)
switch (c) {
case 'a':
opt_noaccept = 1;
break;
+ case 'c':
+ client_tos = atoi(optarg);
+ break;
case 'h': /* remote host */
hostname = optarg;
break;
@@ -436,6 +442,12 @@
perror("client: socket");
exit(1);
}
+ /* Set ToS */
+ if (client_tos != -1) {
+ res = setsockopt(conn, IPPROTO_IP, IP_TOS, &client_tos,
sizeof(client_tos));
+ if (res < 0)
+ perror("WARNING: client TOS was not set");
+ }
if (localhost && client_comm_bind(conn, localhost) < 0) {
perror("client: bind");
exit(1);
--
You received this message because you are subscribed to the Google Groups
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/lusca-commit?hl=en.