"Deleted (3)"
};
+static char *subnet_states[] = {
+ "Reserved (0)",
+ "Billable (1)",
+ "Private (2)",
+ "Resnet (3)",
+ "Infrastructure (4)"
+};
+
static char *MacState(int state)
{
static char buf[BUFSIZ];
return states[state];
}
+static char *SubnetState(int state)
+{
+ static char buf[BUFSIZ];
+ if (state < 0 || state > 4)
+ {
+ sprintf(buf, "Unknown (%d)", state);
+ return buf;
+ }
+ return subnet_states[state];
+}
/* -------------------- Set Defaults -------------------- */
info[M_LOC] = strdup(M_DEFAULT_TYPE);
info[M_CONTACT] = strdup(M_DEFAULT_TYPE);
info[M_BILL_CONTACT] = strdup(M_DEFAULT_TYPE);
+ info[M_ACCT_NUMBER] = strdup("");
info[M_USE] = strdup("0");
info[M_STAT] = strdup("1");
info[M_SUBNET] = strdup("NONE");
{
char buf[256];
- info[C_NAME] = strdup(name);
+ info[SN_NAME] = strdup(name);
info[SN_DESC] = strdup("");
+ info[SN_STATUS] = strdup("1");
sprintf(buf, "%ld", ntohl(inet_addr("18.255.0.0")));
info[SN_ADDRESS] = strdup(buf);
sprintf(buf, "%ld", ntohl(inet_addr("255.255.0.0")));
MacState(atoi(info[M_STAT])), info[M_STAT_CHNG]);
Put_message(buf);
Put_message("");
-
sprintf(buf, "Vendor: %-16s Location: %s", info[M_VENDOR],
info[M_LOC]);
Put_message(buf);
sprintf(buf, "OS: %-16s Billing Contact: %s", info[M_OS],
info[M_BILL_CONTACT]);
Put_message(buf);
- Put_message("");
- sprintf(buf, "Opt: %s", info[M_USE]);
+ sprintf(buf, "Opt: %-16s Account Number: %s", info[M_USE],
+ info[M_ACCT_NUMBER]);
Put_message(buf);
Put_message("");
sprintf(buf, "Adm cmt: %s", info[M_ACOMMENT]);
Put_message(buf);
sprintf(buf, " Description: %s", info[SN_DESC]);
Put_message(buf);
+ sprintf(buf, " Status: %s", SubnetState(atoi(info[SN_STATUS])));
+ Put_message(buf);
addr.s_addr = htonl(atoi(info[SN_ADDRESS]));
mask.s_addr = htonl(atoi(info[SN_MASK]));
low.s_addr = htonl(atoi(info[SN_LOW]));
if (GetValueFromUser("Machine's billing contact",
&info[M_BILL_CONTACT]) == SUB_ERROR)
return NULL;
+ if (GetValueFromUser("Machine's billing account number",
+ &info[M_ACCT_NUMBER]) == SUB_ERROR)
+ return NULL;
while (1)
{
int i;
if (name)
{
/* info did not come from SetMachineDefaults(), which does not
- * initialize entry 8 (M_STAT_CHNG), therefore we can
+ * initialize entry 10 (M_STAT_CHNG), therefore we can
* free it.
*/
/* This is an update of an existing machine and the structure
* was filled in thru a query to the db which does fill in this
* field.
*/
- free(info[9]);
+ free(info[10]);
}
- info[9] = info[M_SUBNET];
- info[10] = info[M_ADDR];
- info[11] = info[M_OWNER_TYPE];
- info[12] = info[M_OWNER_NAME];
- info[13] = info[M_ACOMMENT];
- info[14] = info[M_OCOMMENT];
+ info[10] = info[M_SUBNET];
+ info[11] = info[M_ADDR];
+ info[12] = info[M_OWNER_TYPE];
+ info[13] = info[M_OWNER_NAME];
+ info[14] = info[M_ACOMMENT];
+ info[15] = info[M_OCOMMENT];
if (name)
{
- if (GetValueFromUser("Machine's network (or 'none')", &info[9])
+ if (GetValueFromUser("Machine's network (or 'none')", &info[10])
== SUB_ERROR)
return NULL;
}
if (GetValueFromUser("Machine's address (or 'unassigned' or 'unique')",
- &info[10]) == SUB_ERROR)
+ &info[11]) == SUB_ERROR)
return NULL;
- if (GetTypeFromUser("Machine's owner type", "ace_type", &info[11]) ==
+ if (GetTypeFromUser("Machine's owner type", "ace_type", &info[12]) ==
SUB_ERROR)
return NULL;
- if (strcmp(info[11], "NONE") &&
- GetValueFromUser("Owner's Name", &info[12]) == SUB_ERROR)
+ if (strcmp(info[12], "NONE") &&
+ GetValueFromUser("Owner's Name", &info[13]) == SUB_ERROR)
return NULL;
- if (!strcmp(info[11], "KERBEROS"))
+ if (!strcmp(info[12], "KERBEROS"))
{
char *canon;
- mrcl_validate_kerberos_member(info[12], &canon);
+ mrcl_validate_kerberos_member(info[13], &canon);
if (mrcl_get_message())
Put_message(mrcl_get_message());
- free(info[12]);
- info[12] = canon;
+ free(info[13]);
+ info[13] = canon;
}
- if (GetValueFromUser("Administrative comment", &info[13]) == SUB_ERROR)
+ if (GetValueFromUser("Administrative comment", &info[14]) == SUB_ERROR)
return NULL;
- if (GetValueFromUser("Operational comment", &info[14]) == SUB_ERROR)
+ if (GetValueFromUser("Operational comment", &info[15]) == SUB_ERROR)
return NULL;
- info[15] = NULL;
- FreeAndClear(&info[16], TRUE);
+ info[16] = NULL;
FreeAndClear(&info[17], TRUE);
+ FreeAndClear(&info[18], TRUE);
break;
case SUBNET:
if (GetValueFromUser("Network description", &info[SN_DESC]) == SUB_ERROR)
return NULL;
+ while (1)
+ {
+ int i;
+ if (GetValueFromUser("Network's status (? for help)",
+ &info[SN_STATUS]) == SUB_ERROR)
+ return NULL;
+ if (isdigit(info[SN_STATUS][0]))
+ break;
+ Put_message("Valid status numbers:");
+ for (i = 0; i < 5; i++)
+ Put_message(subnet_states[i]);
+ }
if (GetAddressFromUser("Network address", &info[SN_ADDRESS]) == SUB_ERROR)
return NULL;
if (GetAddressFromUser("Network mask", &info[SN_MASK]) == SUB_ERROR)
sprintf(buf, "Container: %s", info[CON_NAME]);
Put_message(buf);
- return "";
}
static char *PrintMContMap(char **info)
FreeQueue(top);
return DM_NORMAL;
}
-
-int GetTopLevelCont(int argc, char **argv)
-{
- int status;
- struct mqelem *elem = NULL;
- if (status = do_mr_query("get_toplevel_containers", 0, NULL, StoreInfo,
- &elem))
- {
- com_err(program_name, status, " in get_toplevel_containers");
- return DM_NORMAL;
- }
- Loop(QueueTop(elem), (void(*)(char **)) PrintContainer);
- FreeQueue(elem);
- return DM_NORMAL;
-}