smb_session.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // This file is part of libdsm
  2. // Author: Julien 'Lta' BALLET <contact@lta.io>
  3. // Copyright VideoLabs 2014
  4. // License: MIT License
  5. #ifndef __BDSM_SMB_SESSION_H_
  6. #define __BDSM_SMB_SESSION_H_
  7. #include "bdsm/netbios_session.h"
  8. #include "bdsm/smb_defs.h"
  9. #include "bdsm/smb_message.h"
  10. #define SMB_STATE_DIALECT_OK 2
  11. #define SMB_STATE_NETBIOS_OK 1
  12. #define SMB_STATE_NEW 0
  13. #define SMB_STATE_ERROR -1
  14. typedef struct
  15. {
  16. int state;
  17. unsigned dialect;
  18. netbios_session_t *nb_session;
  19. } smb_session_t;
  20. smb_session_t *smb_session_new();
  21. void smb_session_destroy(smb_session_t *s);
  22. int smb_session_send_msg(smb_session_t *s, smb_message_t *msg);
  23. // msg->packet will be updated to point on received data. You don't own this
  24. // memory. It'll be reused on next recv_msg
  25. size_t smb_session_recv_msg(smb_session_t *s, smb_message_t *msg);
  26. int smb_session_connect(smb_session_t *s, char *name, uint32_t ip);
  27. int smb_session_negotiate_protocol(smb_session_t *s);
  28. #endif