Finish dot_get and dot_free

- Finish dot_get and dot_free, and complete their comments
- Use macro instead of hard-coded values
- use const more properly
- use uint8_t instead of unsigned char