⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wizard_curs.c

📁 GNUnet是一个安全的点对点网络框架
💻 C
📖 第 1 页 / 共 2 页
字号:
            case DLG_EXIT_HELP:              show_help (_("The \"Network interface\" is the device "                           "that connects your computer to the internet. This is usually a modem, "                           "an ISDN card or a network card in case you are using DSL."));              break;            case DLG_EXIT_ESC:            case DLG_EXIT_ERROR:            case DLG_EXIT_CANCEL:              return 0;            }        }    }  return query_string (_("Network configuration: interface"),                       _                       ("What is the name of the network interface that connects your computer to the Internet?"),                       _("The \"Network interface\" is the device "                         "that connects your computer to the internet. This is usually a modem, "                         "an ISDN card or a network card in case you are using DSL."),                       "NETWORK", "INTERFACE", GNUNET_DEFAULT_INTERFACE);}static intip_address (){  /* TODO: try autodetect! */  return query_string (_("Network configuration: IP"),                       _                       ("What is this computer's public IP address or hostname?"),                       _("If your provider always assigns the same "                         "IP-Address to you (a \"static\" IP-Address), enter it into the "                         "\"IP-Address\" field. If your IP-Address changes every now and then "                         "(\"dynamic\" IP-Address) but there's a hostname that always points "                         "to your actual IP-Address (\"Dynamic DNS\"), you can also enter it "                         "here.\n"                         "If left empty, GNUnet will try to automatically detect the IP.\n"                         "You can specify a hostname, GNUnet will then use DNS to resolve it.\n"                         "If in doubt, leave this empty."), "NETWORK", "IP",                       "");}static intnetwork_load_up (){  return query_string (_("Bandwidth configuration: upload"),                       _                       ("How much upstream bandwidth (in bytes/s) may be used?"),                       _("You can limit GNUnet's resource usage "                         "here.\n\nThe \"upstream\" is the data channel through which data "                         "is *sent* to the internet. The limit is the maximum amount "                         "which GNUnet is allowed to use. If you have a flatrate, you can set it to "                         "the maximum speed of your internet connection. You should not use a value "                         "that is higher than what your actual connection allows."),                       "LOAD", "MAXNETUPBPSTOTAL", "50000");}static intnetwork_load_down (){  return query_string (_("Bandwidth configuration: download"),                       _                       ("How much downstream bandwidth (in bytes/s) may be used?"),                       _("You can limit GNUnet's resource usage "                         "here.\n\nThe \"downstream\" is the data channel through which data "                         "is *received* from the internet. The limit is the maximum amount "                         "which GNUnet is allowed to use. If you have a flatrate, you can set it to "                         "the maximum speed of your internet connection. You should not use a value "                         "that is higher than what your actual connection allows."),                       "LOAD", "MAXNETDOWNBPSTOTAL", "50000");}static intdisk_quota (){  return query_string (_("Quota configuration"),                       _("What is the maximum size of the datastore in MB?"),                       _("The GNUnet datastore contains all content that "                         "GNUnet needs to store (indexed, inserted and migrated content)."),                       "FS", "QUOTA", "1024");}static intuser (){  if (GNUNET_YES !=      GNUNET_configure_user_account (GNUNET_YES, GNUNET_YES, "gnunet",                                     "gnunet"))    return last;                /* ignore option */  return query_string (_("Daemon configuration: user account"),                       _("As which user should gnunetd be run?"),                       _                       ("For security reasons, it is a good idea to let this setup create "                        "a new user account under which the GNUnet service is started "                        "at system startup.\n\n"                        "However, GNUnet may not be able to access files other than its own. "                        "This includes files you want to publish in GNUnet. You'll have to "                        "grant read permissions to the user specified below.\n\n"                        "Leave the field empty to run GNUnet with system privileges.\n"),                       "GNUNETD", "USER", "gnunet");}static intgroup (){  if (GNUNET_YES !=      GNUNET_configure_user_account (GNUNET_YES, GNUNET_YES, "gnunet",                                     "gnunet"))    return last;                /* ignore option */  return query_string (_("Daemon configuration: group account"),                       _("As which group should gnunetd be run?"),                       _                       ("For security reasons, it is a good idea to let this setup create "                        "a new group for the chosen user account.\n\n"                        "You can also specify a already existent group here.\n\n"                        "Only members of this group will be allowed to start and stop the "                        "the GNUnet server and have access to GNUnet server data.\n"),                       "GNUNETD", "GROUP", "gnunet");}static intautostart (){  return query_yesno (_("GNUnet configuration"),                      _                      ("Do you want to automatically launch GNUnet as a system service?"),                      _                      ("If you say \"yes\" here, the GNUnet background process will be "                       "automatically started when you turn on your computer. If you say \"no\""                       " here, you have to launch GNUnet yourself each time you want to use it."),                      "GNUNETD", "AUTOSTART");}/** * Save configuration, setup username, group and autostart. */static intfinish (){  const char *prefix;  char *err;  int ret;  char *user_name;  char *group_name;  ret = GNUNET_OK;  if ((0 != GNUNET_GC_test_dirty (cfg)) &&      (0 != GNUNET_GC_write_configuration (cfg, cfg_fn)))    {      prefix = _("Unable to save configuration file `%s':");      err = GNUNET_malloc (strlen (cfg_fn) + strlen (prefix) + 1);      sprintf (err, prefix, cfg_fn);      showCursErr (err, STRERROR (errno));      GNUNET_free (err);      ret = GNUNET_SYSERR;    }  user_name = NULL;  GNUNET_GC_get_configuration_value_string (cfg, "GNUNETD", "USER", "",                                            &user_name);  GNUNET_GC_get_configuration_value_string (cfg, "GNUNETD", "GROUP", "",                                            &group_name);  if (((strlen (user_name) > 0) || (strlen (group_name) > 0))      && (GNUNET_OK ==          GNUNET_configure_user_account (GNUNET_YES, GNUNET_YES, user_name,                                         group_name))      && (GNUNET_OK !=          GNUNET_configure_user_account (GNUNET_NO, GNUNET_YES, user_name,                                         group_name)))    {      showCursErr (_("Unable to create user account for daemon."), "");      ret = GNUNET_SYSERR;    }  if ((GNUNET_YES ==       GNUNET_GC_get_configuration_value_yesno (cfg, "GNUNETD", "AUTOSTART",                                                GNUNET_NO))      && (GNUNET_OK !=          GNUNET_GNS_wiz_autostart_service (ectx, GNUNET_SERVICE_TYPE_GNUNETD,                                            GNUNET_YES, user_name,                                            group_name)))    {      showCursErr (_("Unable to setup autostart for daemon."), "");      ret = GNUNET_SYSERR;    }  GNUNET_free (user_name);  GNUNET_free (group_name);  return ret;}static intsave_config (){  int ret;  /* TODO: check configuration changed! */  dialog_vars.help_button = 0;  ret = dialog_yesno (_("Save configuration?"),                      _("Save configuration now?"), 5, 60);  switch (ret)    {    case DLG_EXIT_OK:      if (GNUNET_OK != finish ())        return 0;               /* error */      return 1;    case DLG_EXIT_CANCEL:      return 1;                 /* advance */    case DLG_EXIT_ESC:      return 0;                 /* abort */    case DLG_EXIT_EXTRA:      return -1;                /* back */    default:      GNUNET_GE_BREAK (ectx, 0);      break;    }  return 1;}intwizard_curs_mainsetup_curses (int argc,                              const char **argv,                              struct GNUNET_PluginHandle *self,                              struct GNUNET_GE_Context *e,                              struct GNUNET_GC_Configuration *c,                              struct GNUNET_GNS_Context *gns,                              const char *filename, int is_daemon){  struct termios ios_org;  unsigned int phase;  int ret;  int dir;  ectx = e;  cfg = c;  cfg_fn = filename;#ifndef MINGW  tcgetattr (1, &ios_org);#endif  dialog_vars.backtitle = _("GNUnet Configuration");  dialog_vars.item_help = 1;  dialog_vars.help_button = 1;  dialog_vars.extra_button = 1;  dialog_vars.extra_label = _("Back");  init_dialog (stdin, stderr);  phase = 0;  ret = GNUNET_NO;  while (ret == GNUNET_NO)    {      switch (phase)        {        case 0:          dir = welcome ();          break;        case 1:          dir = network_interface ();          break;        case 2:          dir = ip_address ();          break;        case 3:          dir = network_load_up ();          break;        case 4:          dir = network_load_down ();          break;        case 5:          dir = disk_quota ();          break;        case 6:          dir = user ();          break;        case 7:          dir = group ();          break;        case 8:          dir = autostart ();          break;        case 9:          dir = save_config ();          break;        case 10:          dir = 0;          ret = GNUNET_OK;          break;        default:          GNUNET_GE_BREAK (NULL, 0);          dir = 0;          break;        }      phase += dir;      last = dir;      if (dir == 0)        ret = GNUNET_SYSERR;    }  end_dialog ();#ifndef MINGW  tcsetattr (1, TCSAFLUSH, &ios_org);#endif  return ret;}/* end of wizard_curs.c */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -