Beispiel #1
0
LogDriver *
afinet_sd_new(gint af, gchar *host, gint port, guint flags)
{
  AFInetSourceDriver *self = g_new0(AFInetSourceDriver, 1);
  
  afsocket_sd_init_instance(&self->super, &self->sock_options.super, flags);
  self->super.flags |= AFSOCKET_KEEP_ALIVE;
  if (af == AF_INET)
    {
      self->super.bind_addr = g_sockaddr_inet_new("0.0.0.0", port);
      if (!host)
        host = "0.0.0.0";
    }
  else
    {
#if ENABLE_IPV6
      self->super.bind_addr = g_sockaddr_inet6_new("::", port);
      if (!host)
        host = "::";
#else
      g_assert_not_reached();
#endif
    }
  afinet_resolve_name(self->super.bind_addr, host);
  self->super.setup_socket = afinet_sd_setup_socket;
    
  return &self->super.super;
}
Beispiel #2
0
LogDriver *
afunix_sd_new(gchar *filename, guint32 flags)
{
  AFUnixSourceDriver *self = g_new0(AFUnixSourceDriver, 1);

  afsocket_sd_init_instance(&self->super, &self->sock_options, flags);
  self->super.flags |= AFSOCKET_KEEP_ALIVE;
  self->super.bind_addr = g_sockaddr_unix_new(filename);
  self->super.super.super.init = afunix_sd_init;
  self->super.super.super.free_fn = afunix_sd_free;
  self->filename = g_strdup(filename);
  self->owner = -1;
  self->group = -1;
  self->perm = 0666;
  return &self->super.super;
}
Beispiel #3
0
AFUnixSourceDriver *
afunix_sd_new_instance(TransportMapper *transport_mapper, gchar *filename)
{
  AFUnixSourceDriver *self = g_new0(AFUnixSourceDriver, 1);

  afsocket_sd_init_instance(&self->super, socket_options_new(), transport_mapper);

  self->super.super.super.super.init = afunix_sd_init;
  self->super.super.super.super.free_fn = afunix_sd_free;
  self->super.acquire_socket = afunix_sd_acquire_socket;
  self->super.setup_addresses = afunix_sd_setup_addresses;

  self->super.max_connections = 256;
  self->super.recvd_messages_are_local = TRUE;

  self->filename = g_strdup(filename);
  file_perm_options_defaults(&self->file_perm_options);
  self->file_perm_options.file_perm = 0666;

  afunix_sd_adjust_reader_options(self, configuration);
  return self;
}
SystemDSyslogSourceDriver*
systemd_syslog_sd_new(GlobalConfig *cfg, gboolean fallback)
{
  SystemDSyslogSourceDriver *self;
  TransportMapper *transport_mapper;

  self = g_new0(SystemDSyslogSourceDriver, 1);
  transport_mapper = transport_mapper_unix_dgram_new();

  afsocket_sd_init_instance(&self->super, socket_options_new(), transport_mapper, cfg);

  self->super.super.super.super.init = systemd_syslog_sd_init_method;

  self->super.acquire_socket = systemd_syslog_sd_acquire_socket;
  self->super.max_connections = 256;
  self->super.recvd_messages_are_local = TRUE;

  if (!self->super.bind_addr)
    self->super.bind_addr = g_sockaddr_unix_new(NULL);

  return self;
}
Beispiel #5
0
AFUnixSourceDriver *
afunix_sd_new_instance(TransportMapper *transport_mapper, gchar *filename, GlobalConfig *cfg)
{
  AFUnixSourceDriver *self = g_new0(AFUnixSourceDriver, 1);

  afsocket_sd_init_instance(&self->super, socket_options_new(), transport_mapper, cfg);

  self->super.super.super.super.init = afunix_sd_init;
  self->super.super.super.super.free_fn = afunix_sd_free;
  self->super.setup_addresses = afunix_sd_setup_addresses;

  self->super.max_connections = 256;
  self->super.recvd_messages_are_local = TRUE;

  self->filename = g_strdup(filename);
  file_perm_options_defaults(&self->file_perm_options);
  self->file_perm_options.file_perm = 0666;
  self->pass_unix_credentials = cfg->pass_unix_credentials;
  self->create_dirs = cfg->create_dirs;
  afunix_sd_set_pass_unix_credentials(self, self->pass_unix_credentials);

  afunix_sd_adjust_reader_options(self, cfg);
  return self;
}