| 1 |
/* |
| 2 |
felicalib - FeliCa access wrapper library |
| 3 |
|
| 4 |
Copyright (c) 2007, Takuya Murakami, All rights reserved. |
| 5 |
|
| 6 |
Redistribution and use in source and binary forms, with or without |
| 7 |
modification, are permitted provided that the following conditions are |
| 8 |
met: |
| 9 |
|
| 10 |
1. Redistributions of source code must retain the above copyright notice, |
| 11 |
this list of conditions and the following disclaimer. |
| 12 |
|
| 13 |
2. Redistributions in binary form must reproduce the above copyright |
| 14 |
notice, this list of conditions and the following disclaimer in the |
| 15 |
documentation and/or other materials provided with the distribution. |
| 16 |
|
| 17 |
3. Neither the name of the project nor the names of its contributors |
| 18 |
may be used to endorse or promote products derived from this software |
| 19 |
without specific prior written permission. |
| 20 |
|
| 21 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 22 |
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 23 |
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 24 |
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 25 |
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 26 |
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 27 |
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 28 |
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 29 |
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 30 |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 31 |
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 |
*/ |
| 33 |
/** |
| 34 |
@file felicaint.h |
| 35 |
|
| 36 |
�����w�b�_ |
| 37 |
*/ |
| 38 |
|
| 39 |
#ifndef _FELICAINT_H |
| 40 |
#define _FELICAINT_H |
| 41 |
|
| 42 |
/** @brief Polling �\���� */ |
| 43 |
typedef struct { |
| 44 |
uint8* system_code; ///< �V�X�e���R�[�h (2byte, �l�b�g���[�N�o�C�g�I�[�_) |
| 45 |
uint8 time_slot; ///< �^�C���X���b�g (0x00, 0x01, 0x03, 0x07, 0x0f ����������) |
| 46 |
} POLLING; |
| 47 |
|
| 48 |
/** @brief �J�[�h�����\���� */ |
| 49 |
typedef struct { |
| 50 |
uint8* card_idm; ///< �J�[�h�� IDm (8byte) |
| 51 |
uint8* card_pmm; ///< �J�[�h�� PMm (8byte) |
| 52 |
} CARD_INFO; |
| 53 |
|
| 54 |
/** @brief read_block_without_encryption �����\���� */ |
| 55 |
typedef struct { |
| 56 |
uint8 *card_idm; ///< IDm |
| 57 |
uint8 number_of_services; ///< �T�[�r�X�R�[�h�� |
| 58 |
uint8 *service_code_list; ///< �T�[�r�X�R�[�h���X�g |
| 59 |
uint8 number_of_blocks; ///< �u���b�N�� |
| 60 |
uint8 *block_list; ///< �u���b�N���X�g |
| 61 |
} INSTR_READ_BLOCK; |
| 62 |
|
| 63 |
/** @brief read_block_without_encryption �o���\���� */ |
| 64 |
typedef struct { |
| 65 |
uint8 *status_flag_1; ///< �X�e�[�^�X�t���O1 |
| 66 |
uint8 *status_flag_2; ///< �X�e�[�^�X�t���O2 |
| 67 |
uint8 *result_number_of_blocks; ///< �f�[�^�u���b�N�� |
| 68 |
uint8 *block_data; ///< �f�[�^�u���b�N |
| 69 |
} OUTSTR_READ_BLOCK; |
| 70 |
|
| 71 |
/** @brief write_block_without_encryption �����\���� */ |
| 72 |
typedef struct { |
| 73 |
uint8 *card_idm; ///< IDm |
| 74 |
uint8 number_of_services; ///< �T�[�r�X�R�[�h�� |
| 75 |
uint8 *service_code_list; ///< �T�[�r�X�R�[�h���X�g |
| 76 |
uint8 number_of_blocks; ///< �u���b�N�� |
| 77 |
uint8 *block_list; ///< �u���b�N���X�g |
| 78 |
uint8 *block_data; ///< ���������f�[�^(16byte) |
| 79 |
} INSTR_WRITE_BLOCK; |
| 80 |
|
| 81 |
/** @brief read_block_without_encryption �o���\���� */ |
| 82 |
typedef struct { |
| 83 |
uint8 *status_flag_1; |
| 84 |
uint8 *status_flag_2; |
| 85 |
} OUTSTR_WRITE_BLOCK; |
| 86 |
|
| 87 |
/** @brief polling_and_request_system_code �����\���� */ |
| 88 |
typedef struct { |
| 89 |
uint8 *card_idm; ///< IDm |
| 90 |
} INSTR_REQ_SYSTEM_CODE; |
| 91 |
|
| 92 |
/** @brief polling_and_request_system_code �o���\���� */ |
| 93 |
typedef struct { |
| 94 |
uint8 number_of_system_codes; ///< �V�X�e���R�[�h�� |
| 95 |
uint8 *system_code_list; ///< �V�X�e���R�[�h�z�� |
| 96 |
} OUTSTR_REQ_SYSTEM_CODE; |
| 97 |
|
| 98 |
/** @brief polling_and_search_service_code �����\���� */ |
| 99 |
typedef struct { |
| 100 |
int buffer_size_of_area_codes; ///< �G���A�R�[�h�o�b�t�@�T�C�Y |
| 101 |
int buffer_size_of_service_codes; ///< �T�[�r�X�R�[�h�o�b�t�@�T�C�Y |
| 102 |
int offset_of_area_service_index; ///< �G���A�T�[�r�X�I�t�Z�b�g(?) |
| 103 |
} INSTR_SEARCH_SERVICE; |
| 104 |
|
| 105 |
/** @brief polling_and_search_service_code �o���\���� */ |
| 106 |
typedef struct { |
| 107 |
int num_service_codes; ///< �T�[�r�X�R�[�h�� |
| 108 |
uint8 *service_code_list; ///< �T�[�r�X�R�[�h�z�� |
| 109 |
int num_area_codes; ///< �G���A�R�[�h�� |
| 110 |
uint8 *area_code_list; ///< �G���A�R�[�h�z�� |
| 111 |
uint8 *end_service_code_list; ///< �G���h�T�[�r�X�R�[�h�z�� |
| 112 |
} OUTSTR_SEARCH_SERVICE; |
| 113 |
|
| 114 |
/* DLL entries */ |
| 115 |
typedef BOOL (*initialize_library_t)(void); |
| 116 |
typedef BOOL (*dispose_library_t)(void); |
| 117 |
typedef BOOL (*open_reader_writer_auto_t)(void); |
| 118 |
typedef BOOL (*close_reader_writer_t)(void); |
| 119 |
typedef BOOL (*polling_and_get_card_information_t)(POLLING *, unsigned char *, CARD_INFO *); |
| 120 |
typedef BOOL (*polling_and_request_system_code_t)(POLLING *, INSTR_REQ_SYSTEM_CODE *, |
| 121 |
CARD_INFO *, OUTSTR_REQ_SYSTEM_CODE *); |
| 122 |
typedef BOOL (*polling_and_search_service_code_t)(POLLING *, INSTR_SEARCH_SERVICE *, |
| 123 |
CARD_INFO *, OUTSTR_SEARCH_SERVICE *); |
| 124 |
typedef BOOL (*read_block_without_encryption_t)(INSTR_READ_BLOCK *, OUTSTR_READ_BLOCK *); |
| 125 |
typedef BOOL (*write_block_without_encryption_t)(INSTR_WRITE_BLOCK *, OUTSTR_WRITE_BLOCK *); |
| 126 |
|
| 127 |
/* structures */ |
| 128 |
/** |
| 129 |
@brief PaSoRi �n���h�� |
| 130 |
|
| 131 |
felica.dll �� DLL �n���h���A������ DLL ���G���g���|�C���g�����������B |
| 132 |
*/ |
| 133 |
struct strpasori { |
| 134 |
HINSTANCE hInstDLL; ///< DLL �n���h�� |
| 135 |
|
| 136 |
#define declare_entry(f) f ## _t f |
| 137 |
declare_entry(initialize_library); |
| 138 |
declare_entry(dispose_library); |
| 139 |
declare_entry(open_reader_writer_auto); |
| 140 |
declare_entry(close_reader_writer); |
| 141 |
declare_entry(polling_and_get_card_information); |
| 142 |
declare_entry(polling_and_request_system_code); |
| 143 |
declare_entry(polling_and_search_service_code); |
| 144 |
declare_entry(read_block_without_encryption); |
| 145 |
declare_entry(write_block_without_encryption); |
| 146 |
#undef declare_entry |
| 147 |
}; |
| 148 |
|
| 149 |
#endif |