context.c 716 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // This file is part of libdsm
  2. // Author: Julien 'Lta' BALLET <contact@lta.io>
  3. // Copyright VideoLabs 2014
  4. // License: MIT License
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include "bdsm/context.h"
  8. bdsm_context_t *bdsm_context_new()
  9. {
  10. bdsm_context_t *ctx;
  11. ctx = malloc(sizeof(bdsm_context_t));
  12. memset((void *)ctx, 0, sizeof(bdsm_context_t));
  13. //if (BDSM_DEBUG)
  14. // event_enable_debug_mode();
  15. //ctx->event_base = event_base_new();
  16. if (!(ctx->ns = netbios_ns_new()))
  17. {
  18. free(ctx);
  19. return (0);
  20. }
  21. return (ctx);
  22. }
  23. void bdsm_context_destroy(bdsm_context_t *ctx)
  24. {
  25. if (!ctx)
  26. return;
  27. // if (ctx->event_base)
  28. // event_base_free(ctx->event_base);
  29. free(ctx);
  30. }